From mboxrd@z Thu Jan 1 00:00:00 1970 From: Nick Dokos Subject: Re: dates before 1970 Date: Mon, 14 Mar 2011 11:11:04 -0400 Message-ID: <25878.1300115464@alphaville.dokosmarshall.org> 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> Reply-To: nicholas.dokos@hp.com Return-path: Received: from [140.186.70.92] (port=50223 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Pz9Qi-0004Zn-QJ for emacs-orgmode@gnu.org; Mon, 14 Mar 2011 11:11:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Pz9Qh-0007t0-1J for emacs-orgmode@gnu.org; Mon, 14 Mar 2011 11:11:32 -0400 Received: from vms173005pub.verizon.net ([206.46.173.5]:41585) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Pz9Qg-0007sE-UA for emacs-orgmode@gnu.org; Mon, 14 Mar 2011 11:11:30 -0400 Received: from alphaville.dokosmarshall.org ([unknown] [173.76.32.106]) by vms173005.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0LI1004H5ZIH2HF0@vms173005.mailsrvcs.net> for emacs-orgmode@gnu.org; Mon, 14 Mar 2011 10:11:12 -0500 (CDT) In-reply-to: Message from Carsten Dominik of "Mon, 14 Mar 2011 11:21:36 BST." <3BB12915-004C-4AD3-9753-E59632B7006A@gmail.com> 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: Carsten Dominik Cc: nicholas.dokos@hp.com, Emacs Org mode mailing list Carsten Dominik wrote: > > On Mar 11, 2011, at 5:30 PM, Nick Dokos wrote: > > > Carsten Dominik 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