Time in Windows and Linux

By default, Windows assumes that the local system clock is set to local time, and updates it accordingly. Ubuntu Linux assumes that the clock is running UTC (essentially Greenwich Mean Time) and will update it on that assumption. Since it knows your location (you specified it at installation, and hopefully updated it when you moved) it will display the correct local time just like windows.

The problem comes when you have a dual boot (Linux and Windows) system. When you reboot from one OS into the other the new OS will assume the system clock is behaving according its own rules, even though the other OS was following its rules. To fix this:

  1. Set up Linux to use local time. Or
  2. Set up Windows to use UTC.

How to Fix Time Differences in Ubuntu 16.04 & Windows 10 Dual Boot explains both of these. The method for (1) works for more recent versions of Ubuntu and (I think) for other systemd-based distributions. In a terminal window enter

timedatectl To find out whether you are using local time or UTC
timedatectl set-local-rtc 1 To use local time
timedatectl set-local-rtc 0 To use UTC

Changing Windows requires a registry edit. A bad registry edit can trash your Windows system, but for this purpose the change is no harder than that for Linux, assuming a little familiarity with the Windows command line and the ability to copy and paste. Open a cmd window. If you have a reasonably modern (i.e. 64 bit) system enter (copy and paste!):

Reg add HKLM\SYSTEM\CurrentControlSet\Control\TimeZoneInformation /v RealTimeIsUniversal /t REG_QWORD /d 1

If you still have a 32 bit system:

Reg add HKLM\SYSTEM\CurrentControlSet\Control\TimeZoneInformation /v RealTimeIsUniversal /t REG_DWORD /d 1

I changed Windows on my systems because it was less work. On this system I have Windows and both Debian and Ubuntu Linux, so it was easier to make one change rather than two.

How to Use the timedatectl Command on Linux has some more details, and also advises against using local time on Linux systems.

Slackware does not use systemd and so the timedatectl command is missing. Slackware uses UTC, so I changed the Windows partition of my Slackware system to also use UTC. There probably is some convoluted way to tell Slackware to use local time, but it seems contrary to the Slackware spirit.

See also How to Sync Your Linux Server Time with Network Time Servers (NTP).

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.