From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric S Fraga Subject: Re: dates before 1970 Date: Fri, 11 Mar 2011 08:47:58 +0000 Message-ID: <87ei6ehwld.fsf@ucl.ac.uk> References: <87ei6en127.fsf@ucl.ac.uk> <5422.1299798393@alphaville.usa.hp.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from [140.186.70.92] (port=54572 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PxzUv-0008Ot-OF for emacs-orgmode@gnu.org; Fri, 11 Mar 2011 05:23:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PxzUq-0006TS-NC for emacs-orgmode@gnu.org; Fri, 11 Mar 2011 05:23:05 -0500 Received: from vscani-d2.ucl.ac.uk ([144.82.108.133]:60314) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PxzUq-0006SO-GZ for emacs-orgmode@gnu.org; Fri, 11 Mar 2011 05:23:00 -0500 In-Reply-To: <5422.1299798393@alphaville.usa.hp.com> (Nick Dokos's message of "Thu, 10 Mar 2011 18:06:33 -0500") 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 Nick Dokos writes: > Eric S Fraga wrote: > >> This is a sort of bug report but possibly more a curiosity... >> >> I imagine this has something to do with time 0 in Unix but I cannot seem >> to be able to enter any date earlier than 1 Jan 1970 using C-c! (say). >> However, once I have entered a date (later than that), I can use >> S- on the year to get to the date I want. This seems rather >> inconsistent? >> >> To be precise, I get the wrong date recorded if I try: >> >> C-c ! 1968-12-10 RET >> >> (where C-c ! is =org-time-stamp-inactive=). >> The result is =[2011-12-10 Sat]= >> >> The bug is not so much that I cannot input dates I want but that the >> inactive timestamp generated is *incorrect* and yet there is no error >> message. >> > > Good one! The culprit is org-read-date-analyze which near the end contains > this snippet of code: > > ,---- > | ... > | (if (< year 100) (setq year (+ 2000 year))) > | (if (< year 1970) (setq year (nth 5 defdecode))) ; not representable > | (setq org-read-date-analyze-futurep futurep) > | (list second minute hour day month year))) > `---- > > The trouble is that the caller (org-read-date) takes the result and > does a round-trip through the emacs time encode/decode functions to make > sure the result is sane. Dates before 1970 would break that (I get (0 9 > 10 26 11 2033 6 nil -18000)) so it seems it wraps around to 2033 or > so). Yes, that makes sense. > In addition, most callers of org-read-date call it with a non-nil > to-time argument: that makes it return an emacs-encoded time (which is > then manipulated as such and which I believe has to satisfy the >=1970 > requirement). > > So I'd guess raising an exception might be the simplest way to deal with > this. Here's a patch to try out: This seems to work fine. Thanks. I am glad, however, that I can enter any date and then use the S- etc. keys to get the date I want. Of course, I am not sure if anything else in org breaks as a result... org-sparse-tree with very old scheduled dates seems to work. Haven't tried much else and I would guess few would notice? Thanks again, eric -- : Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D) in Emacs 24.0.50.1 : using Org-mode version 7.5 (release_7.5.27.gefa56.dirty)