From mboxrd@z Thu Jan 1 00:00:00 1970 From: Allen Li Subject: Re: Bug: org-2ft and/or float-time is wrong [9.1.2 (9.1.2-22-ga2a034-elpaplus @ ~/.emacs.d/elpa/org-plus-contrib-20171023/)] Date: Tue, 31 Oct 2017 23:26:19 -0700 Message-ID: References: <87bmknkwhe.fsf@nicolasgoaziou.fr> <87tvyfjgjk.fsf@nicolasgoaziou.fr> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47283) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1e9mTl-0006AI-US for emacs-orgmode@gnu.org; Wed, 01 Nov 2017 02:26:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1e9mTk-0007uL-NK for emacs-orgmode@gnu.org; Wed, 01 Nov 2017 02:26:21 -0400 Received: from mail-qk0-x235.google.com ([2607:f8b0:400d:c09::235]:49730) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1e9mTk-0007ta-I1 for emacs-orgmode@gnu.org; Wed, 01 Nov 2017 02:26:20 -0400 Received: by mail-qk0-x235.google.com with SMTP id q83so1536362qke.6 for ; Tue, 31 Oct 2017 23:26:20 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Tim Cross Cc: emacs-orgmode@gnu.org, Nicolas Goaziou On Tue, Oct 31, 2017 at 10:41 PM, Tim Cross wrote: > > I think this whole issue really requires a lot more analysis and > design. Just removing or cancelling various commits is unlikely to > improve matters and could result in new problems. You're right, but the new behavior was introduced fairly recently. > For org to work correctly, especially when interacting/interfacing with > other systems, such as external calendars, the use of timestamps must > handle timezones consistently and accurately. This is the only way that > any daylight savings calculations will work consistently as different > timezones have different rules for when daylight savings start/finish > (and these rules change). > > If the tests only support UTC/GMT timezone, they are poor tests and need > to be adjusted to use whatever the timezone is on the system running the > tests. > > I also wonder if there is some inconsistencies in how timestamps without > a time component are being handled. It would be good to know if the > issues Alan has observed exist when a full timestamp is used ie. one > with HH:MM:SS.s and not just date. If timezones are not been applied > consistently when choosing the default i.e. 00:00:00.0 with respect to > timezone offset, you will get inconsistencies when moving between > displayed (string) and calculated (number/seconds since epoch) values. I think we first need to agree on how Org mode should handle time. What seems most natural to me is: * Floating point timestamps are Unix timestamps, seconds since Epoch. * Org format time strings are interpreted in the local machine's time zone. Let us assume that my timezone is UTC-07. In that case, <2017-10-30> should be interpreted as 2017-10-30T00:00:00-0700, or 2017-10-30T07:00:00+0000. <2017-10-30> 1509346800.0 2017-10-30T00:00:00-0700 2017-10-30T07:00:00+0000 <2017-10-30 12:34> 1509392040.0 2017-10-30T12:34:00-0700 2017-10-30T19:34:00+0000 Currently, org-2ft returns: <2017-10-30> 1509321600.0 2017-10-29T17:00:00-0700 2017-10-30T00:00:00+0000 <2017-10-30 12:34> 1509366840.0 2017-10-30T05:34:00-0700 2017-10-30T12:34:00+0000 This is because org-2ft calls org-parse-time-string with t for zone, i.e. parse the time string as though it were UTC. That should be apparent from the last column. Hopefully, we can agree that the former is the desired behavior. Working on this assumption, org-2ft should be changed to the original behavior, i.e., to not parse time strings as UTC. The question then becomes, what breaks if we just naively change org-2ft? The new behavior was only added to org-2ft four months ago, so worst case is reverting every time-related change in the interim puts us back four months in time-related logic. But looking through the history, most of the time-related changes in the interim were to fix regressions caused by the initial logic change. If we revert the original "regression", then those interim changes are also not needed.