From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: dates before 1970 Date: Mon, 14 Mar 2011 18:02:54 +0100 Message-ID: References: <87ei6en127.fsf@ucl.ac.uk> <5422.1299798393@alphaville.usa.hp.com> <87ei6ehwld.fsf@ucl.ac.uk> <4006.1299861015@alphaville.dokosmarshall.org> <3BB12915-004C-4AD3-9753-E59632B7006A@gmail.com> <25878.1300115464@alphaville.dokosmarshall.org> Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Return-path: Received: from [140.186.70.92] (port=57683 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PzBAc-0006kZ-5b for emacs-orgmode@gnu.org; Mon, 14 Mar 2011 13:03:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PzBAb-0005Am-1Y for emacs-orgmode@gnu.org; Mon, 14 Mar 2011 13:03:02 -0400 Received: from mail-wy0-f169.google.com ([74.125.82.169]:62691) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PzBAa-0005Ae-TW for emacs-orgmode@gnu.org; Mon, 14 Mar 2011 13:03:01 -0400 Received: by wyf19 with SMTP id 19so5228091wyf.0 for ; Mon, 14 Mar 2011 10:03:00 -0700 (PDT) In-Reply-To: <25878.1300115464@alphaville.dokosmarshall.org> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: nicholas.dokos@hp.com Cc: Emacs Org mode mailing list On Mar 14, 2011, at 4:11 PM, Nick Dokos wrote: > Carsten Dominik wrote: >=20 >>=20 >> On Mar 11, 2011, at 5:30 PM, Nick Dokos wrote: >>=20 >>> Carsten Dominik wrote: >>>=20 >>>=20 >>>> 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). >>>>=20 >>>> For example, Bastien can represent dates before 1970. I cannot. >>>> I can represent dates after 2038, Bastien cannot. >>>>=20 >>>> 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.... >>>>=20 >>>=20 >>> 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... >>=20 >> I believe that on your system you might get >>=20 >> (hi48 lo16 ms) >>=20 >> You can test if it is signed by trying a date before 1970 >>=20 >> (encode-time 0 0 0 1 1 1960) >>=20 >=20 > 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 have no idea what you are talking about :) >=20 > I get >=20 > (encode-time 0 0 0 1 1 1960) > (-4816 20176) >=20 > (decode-time '(-4816 20176)) > (0 0 0 1 1 1960 5 nil -18000) >=20 > so it is indeed signed. >=20 > 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. Great. Don't you love OpenSource projects? >=20 > Thanks, > Nick >=20 - Carsten