christopherjwhite / org-toodledo

Emacs enhancement for syncing org-mode tasks with Toodledlo
83 stars 16 forks source link

Daylight Savings Time -- sync bug ? -- when creating new tasks locally. #33

Closed lawlist closed 10 years ago

lawlist commented 10 years ago

Newly created local tasks with due date / times after the November daylight savings are being synchronized to the Toodledo server as one hour ahead -- e.g., November 6, 2013 at 8:30 a.m. synchronizes to the Toodledo server as 9:30 a.m.

I'm in Los Angeles, California -- using OSX 10.6.8. -- system preferences time zone "Pacific Daylight Time".

lawlist commented 10 years ago

As of today (November 3, 2013 at 9:00 a.m. Pacific Standard Time), all tasks created / modified in Emacs (setting the date for today) are synchronizing to the Toodledo server as yesterday.

In Los Angeles, California, the clocks changed backwards one hour at 2:00 a.m. -- the system preferences time zone on OSX 10.6.8 now shows Pacific Standard Time.

lawlist commented 10 years ago

This is the current workaround:

(cond
  ((equal (car (cdr (current-time-zone))) "PDT")
    (setenv "TZ" "UTC+9"))
  ((equal (car (cdr (current-time-zone))) "PST")
    (setenv "TZ" "UTC+8")))
christopherjwhite commented 10 years ago

Oh how I love timezones, particularly Daylight Savings!

Here's what I know:

org-toodledo just relies on org to convert a timestring like <2014-04-15 Tue 09:00> into a timestamp via org-time-string-to-seconds. This uses the systems default timezone, unless you set the TZ variable as you have. This converts the time to a epoch seconds since 1970 GMT.

For example:

Eval: (org-time-string-to-seconds "<2014-04-15 Tue 09:00>")
1397566800.0

I'm currently in EDT (-0400), and this matches the time from unix date command:

date -d "Sun Apr 15 09:00 -0400 2014" +"%s"
1397566800

At best, I don't think there is much to do about this in org-toodledo, probably not even org-mode. I seem to recall having a problem once before with the Toodledo server not displaying date/times correctly relative to DST.

A few things to check:

Reopen if you find something in org-toodledo that you think could address this.

lawlist commented 10 years ago

Thank you for the helpful information -- greatly appreciated. I'm not sure if you use the calendar in Emacs. I have mine set up to color-code the tasks / events for both a 3-month calendar view and a 12-month calendar view, and both scroll forwards/ backwards by month. Here is a link to the Github source code. I've made some modifications in my own personal setup and need to update Github when I have the time with some improvements, but the example is already working quite nicely. https://github.com/lawlist/calendar-yearly-scroll-by-month