Search code examples
c#dst

Daylight Saving Time change schedule trigger for a marginal time


I'm coding a scheduling app and I'm curious how to handle the following marginal situation concerning the Daylight Saving Time (DST) change:

Say, we're in the time zone where the DST:

  • Starts on 2014-Mar-9 at 2:00:00 AM (clock is adjusted forward)
  • Ends on 2014-Nov-2 at 2:00:00 AM (clock is adjusted backward)

Suppose, an end-user scheduled my app for 2014-Nov-2, 2:00:00 AM.

Let's assume that the local date/time now is 2014-Nov-2, 1:59:99 AM.

When should my app fire the schedule -- in 1 second, or in 1 hour and 1 second?

Is there a standard that defines how to deal with this situation?


Solution

  • According to wikipedia the rules for daylight saving time are:

    ...in spring the clock jumps forward from the last moment of 01:59 standard time to 03:00 DST and that day has 23 hours, whereas in autumn the clock jumps backward from the last moment of 01:59 DST to 01:00 standard time, repeating that hour, and that day has 25 hours.[37] A digital display of local time does not read 02:00 exactly at the shift to summertime, but instead jumps from 01:59:59.9 forward to 03:00:00.0.

    So while the time and date is different around the world the rules are similar(ignoring Australia's Lord Howe Island which uses a half-hour shift). The hour that jumps backwards or forwards is not touched but the hour that is jumped to.

    So in my opinion you should trigger the schedule in one hour and one second.

    If you would trigger it in one second and the user wants to stop the schedule at 3 o'clock it would run for two hours instead of one which appears to be incorrect (2-3 = 1 hour).