0

On my home pc I have two disks, one disk has windows10 installed, the other disk has CentOS 7.9 installed.

It is an Asrock motherboard and has a boot gui that lets me choose which disk to boot, and I go back and forth between windows and linux as I need to.

When I run CentOS and time is correct, I reboot and go into windows and my time is +4 hours ahead... such that it is UTC time. { I am located in Northeast US, with DST we are UTC - 4 } In Windows I click sync time and it corrects, but I have to do that manually every time after I use my CentOS linux disk.

How can I correct this? What is the best way to correct this such that the local time shown in both windows and linux is correct? I suspect CentOS is setting my bios clock to UTC time?

2
  • gadgetgang.com/… Aug 2 '21 at 22:11
  • @AaronD.Marasco, that's a somewhat amusing article. It marks the "make Windows use UTC" solution as "unrecommended" in the heading, but doesn't bother to give any reason for that. Except later in the other section, but then it's still just that 15+ year old Raymond Chan blog which basically boils down to "it's always been like that, and Microsoft doesn't want to change things"... (plus some defences that honestly seem rather made up.) The only reasonable argument there is the one about using scheduled startup.
    – ilkkachu
    Aug 3 '21 at 18:00
3

Windows likes to keep the hardware clock in local time by default, while Linux systems prefer to keep it in UTC. Keeping the clock in UTC is better, in that it allows easier daylight savings transitions without keeping track of which local time the HW clock is in now.

Luckily, it looks like Windows could be configured to UTC too. The registry entry that controls it appears to be HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation\RealTimeIsUniversal, which should be set to 1. (If it doesn't exist, create it first. It should be a QWORD on a 64-bit system, and a DWORD on a 32-bit system.)

I didn't test this, but it's suggested in a few places:


The other option of course is to configure Linux to assume the hardware clock is in the local time. With systemd, the command to use seems to be timedatectl set-local-rtc 1. But note that systemd doesn't really like it, timedatectl warns:

Warning: The system is configured to read the RTC time in the local time zone. This mode cannot be fully supported. It will create various problems with time zone changes and daylight saving time adjustments. The RTC time is never updated, it relies on external facilities to maintain it. If at all possible, use RTC in UTC by calling 'timedatectl set-local-rtc 0'.

If /etc/adjtime exists, the setting is stored there (the third line) for use by the hwclock utility. Systemd updates the file if it exists, but I'm not sure where it stores the setting if the file doesn't exists.

I didn't test this either, and what with the issues with DST, I'd probably try to avoid it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.