Subject: bug#36228: org agenda tags-todo time-zone bug/inconsistency

From: Gary Fredericks <[email-masked]>
Date: Sat, 15 Jun 2019 13:52:48 -0500

I use a (tags-todo "SCHEDULED<\"<now>\"" ()) portion of my org agenda to
suppress scheduled agenda items until their scheduled timestamp has passed.
In more recent commits of emacs I've found this to be an hour off (possibly
due to daylight savings time), in a way that's not just wrong but also
inconsistent with the time shown by the calendar agenda (so it's probably
not related to a more global timezone configuration).

Details:

   - I'm using ubuntu 18.04 and am building emacs myself
   - The failure begins with commit 988e37fa0f922b85271
   - I'm in Chicago, which is currently at -05:00, and during other times
   of the year is at -06:00 -- the tags-todo portion of the agenda is behaving
   as if the local time is -06:00, so daylight savings time smells related
   - I'm reproducing using emacs -q, with the minimal configuration given
   below

The punchline is this agenda, which should be evidently internally
inconsistent (both TODO items should appear up top, but only one of them
does; the "now" line of the calendar agenda is correct):

> Headlines with TAGS match: SCHEDULED<"<now>"
>   whatever:   TODO This one is scheduled for 12pm
>
>
=================================================================================================
> Week-agenda (W24):
> Monday     10 June 2019 W24
> Tuesday    11 June 2019
> Wednesday  12 June 2019
> Thursday   13 June 2019
> Friday     14 June 2019
> Saturday   15 June 2019
>                8:00...... ----------------
>               10:00...... ----------------
>   whatever:   12:00...... Scheduled:  TODO This one is scheduled for 12pm
>               12:00...... ----------------
>   whatever:   13:00...... Scheduled:  TODO This one is scheduled for 1pm
>               13:40...... now - - - - - - - - - - - - - - - - - - - - - -
- - -
>               14:00...... ----------------
>               16:00...... ----------------
>               18:00...... ----------------
>               20:00...... ----------------
> Sunday     16 June 2019

The org-file used for the above (which would need to be adjusted so that,
e.g., the times are the two most recent on-the-hour timestamps) is:

> * TODO This one is scheduled for 12pm
>   SCHEDULED: <2019-06-15 Sat 12:00>
> * TODO This one is scheduled for 1pm
>   SCHEDULED: <2019-06-15 Sat 13:00>

And the agenda configuration is:

> ;; To reproduce: open whatever.org and make sure that one entry is
> ;; within the last hour and another entry is an hour before that one
>
> ;; Then do C-c a n and notice that only one entry is shown in the
> ;; top section even though both should be
>
> (global-set-key "\C-ca" 'org-agenda)
> (setq-default org-agenda-files '("./whatever.org"))
>
> (setq org-agenda-custom-commands
>       `(("n" "Narrow"
>          ((tags-todo "SCHEDULED<\"<now>\"" ())
>  (agenda "" ())))))

Gary Fredericks