If you have installed Linux alongside windows in the dual boot you might have noticed that every time you boot Windows after using Linux it shows the wrong time. And sometimes opposite also happens Linux shows the wrong time when booted into after using Windows. This wrong time in Windows in dual boot system has a very simple fix just continue reading the article.
This might make you feel strange since your system is connected to the internet and the Automatically update time is also turned on. But still, your system shows the wrong time in one of the OS in dual boot.
Don’t worry you are not the only one to face this issue. This issue is pretty common and is caused due to understanding difference between the Linux and Windows.
If you just want a quick fix for the wrong time in Windows and Linux dual boot system, run the below command in the Linux distro terminal. And this will fix it.
timedatectl set-local-rtc 1
There is also another way to fix it, using which you can fix this from Windows only. But first, let’s understand why you see a time difference every time you boot from one OS after another.
Why Windows show the wrong time after booting into Linux?
Time in the computer is stored not in the OS but on the hardware clock called CMOS or BIOS clock. This clock is present on the motherboard of the system. This clock stores time even after the system is unplugged. And this clock is the reason why your system shows the right time every time even when it’s not connected to the internet.
Then there is another clock in the OS that does not store time but at every boot reads the time from this CMOS or BIOS clock. After the boot, the OS clock tracks the time and keeps it updated and right on time. In case of any change, it also updates the time on the system’s hardware clock. This system is almost perfect in itself if used with any one operating system.
But the problem arises when we use both Windows and Linux operating systems on the same machine. As clock present on both the operating system uses a different timezone while reading the time from the hardware clock.
Now let’s see how and why this happens. Suppose you booted your Linux OS after the first boot, you set your time zone, which adjusts the time on the clock of your Linux OS. Now as the Linux clock is updated, it also updates the time on the system’s hardware clock. And by default for Linux OS, the system’s hardware clock is in UTC. Due to this in whatever time zone you are Linux changes the hardware clock time to match it in UTC.
Let’s Understand this with an example
For example, I am here in the time zone UTC+5.30 which is the time zone of Kolkata and the time right now is 13:00. Now when I am using Linux it updates the hardware clock to UTC time, which means 07:30. Now when I restart the system and boot into Windows, it reads the hardware clock time which is in UTC but Windows uses local time zone so it considers it as local time and updates OS’s clock. Due to which even though the actual time is 13:00 Windows will show 07:30.
This problem is caused due to both the operating system using different time zone to read and store the time on the hardware clock.
Sometimes even the opposite can happen. For example, I now updated my Windows clock time to the actual time of 13:00. Then Windows will also update the time on the hardware clock and will make it 13:00 as it uses the local time zone. Now if I restarted my machine and booted Linux it will read hardware clock time considering its UTC. And since my time zone is UTC+5.30 Linux will update its clock timing to 18:30 (Neglecting the time required to restart here). And if I manually update the time or click on sync time in Linux, it will make the time correct in Linux but will change the time on the hardware clock, and this way this cycle continues.
How to Fix this time difference in Windows and Linux in dual boot system?
Now to fix this problem all you need to do is make both operating systems read time in a similar timezone be it UTC or local. For this, all you need to do is to run a single command below in Linux.
timedatectl set-local-rtc 1
This command tells Linux that to use in local time for hardware clock. And it will fix the miscommunication between Windows and Linux. This command will fix the wrong time after boot in the WIndows and Linux dual boot system.
If you want you can also fix this issue from Windows by telling Windows to use the UTC time for the hardware clock. Although changing it in Linux is recommended.
How to make Windows use UTC
To make Windows use UTC time to for hardware clock you need to edit the Windows registry.
Note: The Windows Registry Editor is a powerful tool and misusing it can render your system unstable or even non-working. That's why its recommended to make Linux use local time zone to fix this issue.
If you still want to make changes to Windows to use UTC here is how to do it.
First, open Regedit by searching for
regedit in the Windows search bar or by clicking on the start icon and then searching for it. Now click on regedit to open it and accept the security prompt that will appear. Then in regedit navigate to the below location using the left panel.
Right-click on the
TimeZoneInformation key and select New, in it, select the DWORD (32-bit) Value. In that type
RealTimeIsUniversal for your new value name.
Now double click on the new value you created and in the Value data option enter 1 and then click on OK.
It’s done now you can close the Windows registry editor. Now Windows will also store and read time in UTC from the hardware clock just like Linux. This will fix the wrong time issue while dual-booting Windows and Linux.
In this article, we saw how we can fix the common problem of wrong time when using Windows and Linux in dual boot. Which is caused due to Windows and Linux both using different time zones to read and store the time on the system hardware clock. I hope this helps thanks for reading till last.