So completely random (as always I guess) but I started noticing a problem with my windows PC when booting it up in the evening. I’d be working away or more likely playing games when I’d notice that the time on my PC was an hour behind the time on my phone?

So after a bit of research and learning about hardware clocks (RTC, real time clock), it turns out that the issue was due to my dual boot linux setup. Windows reads the hardware clock on startup and then uses the system clock from then on. Windows interprets the time set in the hardware clock based on local time, and so here in the UK it is UTC/GMT +1 hour (during summer). On the otherhand, when Linux boots up, it assumes that the time stored in the hardware clock is UTC and so it’s actually “an hour behind”.

When both of the systems read the RTC and syncronise their software clocks, they then update the hardware clock according to their own software clock, resulting in this broken time.

For example, on Linux, the time is 08:00am UTC so local time (UTC +1hr) is 09:00am. Linux reads the RTC time as UTC and sets an offset in your software clock because it knows that the RTC is UTC. Dandy! When you then shutdown and boot up Windows, Linux will save the time, let’s say 08:01am as UTC in the RTC. Windows then picks up this time and already assumes that it’s stored as local time (🤨) and so now displays 08:01am. Wrong! The time is currently 09:01am!

The Fix

The easiest fix to the problem is to make Linux use the local time for the RTC so that both are using local time. This can be achieved by running the following command:

timedatectl set-local-rtc 1

TLDR: Linux and Windows interpret the RTC differently, UTC and local time respectively and so innevitably run into issues.