Te curious case of DST

Matthew Saltzman mjs at clemson.edu
Wed Nov 21 14:45:30 UTC 2012


On Tue, 2012-11-20 at 15:53 -0500, Tom Horsley wrote: 
> On Tue, 20 Nov 2012 12:04:13 -0800
> Geoffrey Leach wrote:
> 
> > Yes it is dual-booted with Windoze. However, I have Linux running on 
> > local time for that reason.
> 
> Doesn't matter. They both try to "fix" the clock the first time they
> are booted after the DST change. There is a flag you are supposed
> to be able to set to have it not do that, but over a period of
> many years of DST changes, no flag setting I made in any version of
> Windows seemed to have any effect.

I believe that's not quite correct.  

Linux (at least Red Hat/Fedora) saves the current time in the hardware
clock on shutdown.  If the hardware clock is set to local time, it
assumes the hardware clock is correct on boot.  So if Linux is running
at the moment the time changes, it will save the correct time.  But if
it is off at the time change, it will not correct the time on boot, so
you have to set the hardware clock manually when you start up.  If the
hardware clock is set to UTC, then it will always set the correct time
(according to tzdata).

Windows doesn't touch the hardware clock while running or on shutdown
(though if it is running at the time change, the system clock will
correct itself).  But it adjusts the time on the first boot after the
time change. Windows clock does have an option not to adjust for DST,
but it is set per user.

So you get in trouble if the clock is set to local time and: 
     A. Linux is running at the time change and then you boot into
        Windows.  Then Linux updates the hardware clock on shutdown and
        Windows updates it again on boot. 
     B. you're not running Linux at the time change and you boot Linux
        first after the time change and forget to reset the hardware
        clock.  Then the time is wrong until you boot Windows. 
     C. you're not running Linux at the time change and you boot Linux
        next and correct the hardware clock when you start, then you
        boot Windows and it corrects the clock again. 
     D. some subtle other failure mode I might have missed.

I don't use Windows that much, so my solution (after long thought) is
the following:

     1. Set the hardware clock to UTC in Linux and set Linux to use my
        correct local timezone. 
     2. Set Windows to use GMT as the timezone and turn off the DST
        adjustment in each user's clock settings. 
     3. Now the time is always correct in Linux for my local timezone.
        In Windows, the time is always correct but displays as if GMT
        without DST (basically UTC) were my local time.  That's a little
        awkward, but I have an alternative device to tell me my local
        time anyway.  

I recall that there is a little utility available for Windows that makes
it work with a hardware clock set for UTC, but I've also heard that some
things don't work quite correctly with it.

HTH.

-- 
Matthew Saltzman
Clemson University Math Sciences
mjs AT clemson DOT edu



More information about the users mailing list