Auto Daylight Savings Time behavior (isolated system)
First time on SO and I have a question that I'd like to get your guys' opinion on:
I work on isolated machines (linux OS, no network connections) and one of the issues I'm running across is what should happen when the user Enables an auto DST setting that I've made.
Since not all areas observe DST, the settings requires an 'on/off' type of setting. Furthermore, since the start and stop days seem to vary with the whims of politicians, it can be configured with start month/day/(1st,2nd,3rd,4th) along with s开发者_开发问答top month/day/(1st,2nd,3rd,4th). Yes, I left out '5th' but I don't envision that ever being a start/stop condition. So now the start and stop periods can be defined as flexibly as '1st sunday of march'.
Now the meat of the question: What then should happen when DST is enabled/disabled? I think I would expect it to auto-change the current time if the date & month falls within the DST period. At the same time I have a few users saying that it's a bit strange when the following workflow happens: Set time to 11:00 AM, Set date, Enable DST, time jumps to 12:00PM. Would it make more sense to not change the time upon enable/disable and just wait until the next DST date to correct it?
Looking forward to hearing some opinions :) TIA
I don't know that there's a best choice here. I think it comes down to user preference. Personally I'd probably apply the adjustment when the option is changed, but also try to make the resulting (possible) jump in the time obvious to the user so that if it's not what they expected, they'll know right away that they need to adjust the clock.
Depending on which locales you may need to work with, you should also be aware that not everywhere uses the "first Sunday in March" style for determining when to switch to/from DST. Some places use arbitrary dates hand-picked each year, others may use a specific day of the month. The time of day that the change occurs at varies as well, and some places base their changeover time & date on UTC while others base it on local time. You may need to account for several variations on how the changeover dates are determined unless you're only dealing with a limited set of locations that are more consistent in how they do this.
Even just in Canada, there are places that change at midnight and places that change at 2:00AM, and some that don't change at all.
精彩评论