From: Nick Dokos <nicholas.dokos@hp.com>
To: Carsten Dominik <carsten.dominik@gmail.com>
Cc: nicholas.dokos@hp.com,
Emacs Org mode mailing list <emacs-orgmode@gnu.org>
Subject: Re: dates before 1970
Date: Mon, 14 Mar 2011 11:11:04 -0400 [thread overview]
Message-ID: <25878.1300115464@alphaville.dokosmarshall.org> (raw)
In-Reply-To: Message from Carsten Dominik <carsten.dominik@gmail.com> of "Mon, 14 Mar 2011 11:21:36 BST." <3BB12915-004C-4AD3-9753-E59632B7006A@gmail.com>
Carsten Dominik <carsten.dominik@gmail.com> wrote:
>
> On Mar 11, 2011, at 5:30 PM, Nick Dokos wrote:
>
> > Carsten Dominik <carsten.dominik@gmail.com> wrote:
> >
> >
> >> THis is exactly the point, that it depends on how Emacs was compiled, and what kind of integer is used in the date representation. Signed or unsigend, 32 or 64 bits (I think).
> >>
> >> For example, Bastien can represent dates before 1970. I cannot.
> >> I can represent dates after 2038, Bastien cannot.
> >>
> >> The work-around is to use diary sexps for dates before 1970, that seems to be safe.
> >> And then hope that by 2038, all computers will use 64 bit integers....
> >>
> >
> > But it's even more than that, no? Emacs's time implementation
> > (current-time, encode/decode etc) would have to change. In fact, this
> > might be the most significant limitation right now: the values they pass
> > around are (hi16 lo16 ms) so they assume that time values are 32 bits,
> > no matter what the underlying implementation says. I use 64-bit Linux on
> > an x86-64 laptop and my time_t is 64 bits (but I don't know if it's
> > signed or unsigned). Time for some experimentation I guess...
>
> I believe that on your system you might get
>
> (hi48 lo16 ms)
>
> You can test if it is signed by trying a date before 1970
>
> (encode-time 0 0 0 1 1 1960)
>
Ah, OK - thanks! I looked in current-time, saw the 0xffff mask and I
thought that the extra bits are truncated, but apparently not: I need to
go back and look at the C rules again.
I get
(encode-time 0 0 0 1 1 1960)
(-4816 20176)
(decode-time '(-4816 20176))
(0 0 0 1 1 1960 5 nil -18000)
so it is indeed signed.
I just pulled latest emacs and apparently Paul Eggert has been active in
making this code more robust, presumably after your conversations on the
emacs list.
Thanks,
Nick
next prev parent reply other threads:[~2011-03-14 15:11 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-10 21:00 dates before 1970 Eric S Fraga
2011-03-10 23:06 ` Nick Dokos
2011-03-11 8:31 ` Bastien
2011-03-11 8:52 ` Carsten Dominik
2011-03-13 7:39 ` Carsten Dominik
2011-03-13 20:08 ` Eric S Fraga
2011-03-14 7:40 ` Carsten Dominik
2011-03-14 9:58 ` Bastien
2011-03-11 8:47 ` Eric S Fraga
2011-03-11 11:36 ` Carsten Dominik
2011-03-11 12:00 ` Eric S Fraga
2011-03-11 15:28 ` Carsten Dominik
2011-03-11 17:56 ` Gregor Zattler
2011-03-12 22:38 ` Robert Horn
2011-03-11 16:30 ` Nick Dokos
2011-03-14 10:21 ` Carsten Dominik
2011-03-14 15:11 ` Nick Dokos [this message]
2011-03-14 17:02 ` Carsten Dominik
2011-03-14 17:13 ` Nick Dokos
2011-03-14 18:12 ` Achim Gratz
2011-03-15 7:24 ` Carsten Dominik
2011-03-11 16:16 ` Nick Dokos
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=25878.1300115464@alphaville.dokosmarshall.org \
--to=nicholas.dokos@hp.com \
--cc=carsten.dominik@gmail.com \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).