I have a dual-boot setup with both Windows 10 and Ubuntu 16.04 in it. Everything is working perfectly except I noticed that when I correct the clock from one operating system, it would set a wrong time in the other after reboot.
Let’s take America/Los_Angeles timezone as an example in the simulation below (assume there is only a minute deviation between reboots).
The correct clock at the time of writing this is Wed 2017-04-19 18:28:20 PDT.
Initial Boot: When Ubuntu boots, it sets the current time to the same time as the hardware clock then makes adjustments based on which timezone you set in it thus deriving the “Local time”.
1 2 3 4 5 6 7 |
Local time: Wed 2017-04-19 18:28:20 PDT Universal time: Thu 2017-04-20 01:28:20 UTC RTC time: Thu 2017-04-20 01:28:20 Time zone: America/Los_Angeles (PDT, -0700) Network time on: yes NTP synchronized: yes RTC in local TZ: no |
Reboot 1: When rebooted to Windows afterwards, it assumes that the hardware clock “RTC time” is the current local time and sets the operating system’s time to Thu 2017-04-20 01:29:20 GMT-0700 (PDT)
which is definitely a wrong time and date. What I did is I turned off and back on the “Set time automatically” and “Set time zone automatically” options in Settings > Time & Language > Date & time. This would correct the operating system’s local time as well as update the RTC time to Wed 2017-04-19 18:29:20 GMT-0700 PDT
.
Reboot 2: What happens when the system reboots back to Ubuntu after correcting the time in Windows? It will see that the RTC time is already set to Wed 2017-04-19 18:30:20
and adjusts the system local time based on America/Los_Angeles which is 7 hours behind UTC. The new Ubuntu time would be Wed 2017-04-19 11:30:20 PDT
! Again, we get a wrong time.
As you see, manual and automatic time update from the settings would just result in an unending cycle of correcting the clock when switching from one operating system to another.
Here’s the explanation:
- Windows sees the hardware clock as local time PDT
- Ubuntu sees the hardware clock as universal time UTC
Hardware clock is the common denominator here. Windows and Ubuntu sees the hardware clock differently. The best solution is to make both the operating systems to read the hardware clock as either universal time or local time. There are two approaches – make Windows read the hardware clock as universal time OR make Ubuntu read it as local time. Follow the guide below depending on which operating system you want to adjust.
Set RTC as Local Time
If you decided for both operating systems to use the local time, you just need to make changes in Ubuntu. Windows uses local time for the hardware clock by default.
In Ubuntu, run the following command:
1 2 |
# timedatectl set-local-rtc 1 # timedatectl set-ntp true |
Set RTC as UTC
In contrast, if you decided to go this way, you only need to make adjustments in Windows.
- Open a command prompt as an administrator
- Add a registry entry by running this command
1C:\> reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation" /v RealTimeIsUniversal /d 1 /t REG_DWORD /f - Turn on automatic time update
Conclusion
Though it does not affect the functionality of the system, it is necessary to keep all your system time updated with the correct and standardized information especially when you like to lurk around the Windows events and Linux syslogs. I would recommend using the RTC in the hardware clock to exclude it from the effects of Daylight Saving Time (DST).