Windows and Linux show different times when Dual Booting

I noticed this really irritating issue a couple of days ago and despite changing the time settings within windows, as soon as I restarted the PC either to boot into Linux or Windows, the same issue recurred.

It turns out that the reason behind this is because your computer will store the time in a hardware clock on the motherboard. This enables the computer to keep track of the time even when the computer is turned off and this is achieved by means of a CR2320 or similar watch battery.

Windows, by default, assumes that the time will be stored as “local Time”. Linux however, stores this time as UTC (Coordinated Universal Time) so when this time is stored when you shutdown your computer, If you are shutting down a Linux session then it assumes that the time to be stored will be UTC and apply an offset. It is this process which causes the issue where one of the operating systems will display the incorrect time. There is good news, it’s dead easy to fix and here’s how.

Make Linux use Local Time

The easiest way to do this is to make Linux use local time, the reason for this is that although you can do the reverse and force Windows to use UTC however it is reported that it is not that well supported and that some third party applications assume that the hardware clock is set as local time. UTC is also incompatible with the Windows time-syncing service.

To make your Linux system can vary depending on which version of Linux distribution you are using. For the purposes of this post we will be using the timedatectl command to make this change. This will work on modern versions of Ubuntu, Fedora, Red Hat, Debian, Mint and other systems that use systemd.

To make the actual change open terminal and run the following command.

timedatectl set-local-rtc 1 --adjust-system-clock

To check the current settings, run the following command.

timedatectl

You should see something like this.

Look for RTC in local TZ: yes. This will confirm that Linux is now set to use the local time instead of UTC. You have probably noticed the warning. You should not have to worry too much about this as if you will be dual booting with Windows which will handle daylight saving time for you.

If you want to undo this setting, simply run terminal again and run the following command.

timedatectl set-local-rtc 0 --adjust-system-clock

If you really want to find out why Windows uses local time instead of UTC like other operating systems then visit https://devblogs.microsoft.com/oldnewthing/20040902-00/?p=37983