If, like me, you happen to run a Windows/Linux dual-boot system, the appearance of this little message can be something of an annoyance.

The reason: Windows (at least up to Windows Me; I've not used Windows XP yet so can't vouch for it) directly uses the BIOS clock for all time readings. The hardware clock on a Windows system therefore must be set to the correct local time.

On the other hand, Linux (like most Unix-derived OSs) only reads the hardware clock at startup and shutdown. At all other times it uses its own internal clock, which is a signed int containing the number of UTC seconds elapsed since midnight on 1st January 1970, and performs a software conversion to the correct local time when this is needed. Because of this, it prefers the hardware clock to be set to UTC regardless of the user's time zone.

Now, the first time you boot into Windows after Daylight Saving Time starts or finishes in your area, the system will automatically detect this and, because it assumes the hardware clock is set to local time, adjust the BIOS to compensate. Because Linux has no way of knowing this has happened its clock will be out by at least an hour. In addition, if you initially had the hardware clock set to UTC to keep Linux happy, the clock will likely as not be wrong under Windows as well.

Fortunately, there is a simple solution:

  1. Use your machine's CMOS setup utility to set the hardware clock to UTC.
  2. Boot windows. Go to Start/Settings/Control Panel and double click on "Date and Time". Uncheck the "Automatically perform Daylight Savings update" box and click OK.


    At this point, Linux will show correct local time and windows will show UTC regardless of time zone. For me this is fine, as I use Linux 90% of the time and don't need a correct clock for any of the things I still boot Windows for. If, however, you do need a correct clock under both systems, perform the final step:

  3. Restart the computer and boot Linux. Login to a terminal, and type (as root) the command:

    echo 'UTC="no"' >> /etc/sysconfig/clock

This will cause Linux to perform the local time conversion when it reads from and writes to the hardware clock. As most distributions synchronize the hardware clock with system time on shutdown, this will cause local time to be written to the BIOS on your next reboot.

This will keep Windows happy as the system clock now contains local time, but the double-adjustment problem is avoided because only Linux performs it.

Note: Although the above will work on Red Hat and Mandrake, shallot informs me that under Debian the UTC value is stored in /etc/default/rcS instead. The commands will therefore need according adjustment.