People who dual-boot Windows and Ubuntu have actually run into a really interesting problem: the system time doesn't sync between the two. After switching back to Windows from Linux, the clock is exactly 8 hours behind.
This actually happens because Windows and Linux interpret the hardware clock (RTC) time differently. Our motherboard has a clock chip that stores the physical time, but Windows thinks the time stored in the hardware clock should be local time (for example, if your timezone is UTC+8, the hardware clock should show Beijing time). Linux/Ubuntu thinks the time stored in the hardware clock should be UTC (Coordinated Universal Time).
Let's say your timezone is UTC+8 (Beijing time). The real-world time is 4:00 PM (16:00) Beijing time (local time), and the corresponding UTC time is 8:00 AM (08:00).
Step 1: In Windows
You're using Windows, and the system time correctly shows 16:00 (4:00 PM).
Windows thinks the hardware clock should store local time. So, it writes 16:00 to the hardware clock.
Step 2: Reboot and enter Ubuntu
Boot up the computer and enter Ubuntu.
Ubuntu reads the hardware clock, and by default it assumes the hardware clock stores UTC time. So it reads 16:00.
Ubuntu thinks: "Oh, the hardware clock says UTC time is 16:00. Since my timezone is UTC+8, the local time should be UTC time plus 8 hours."
Calculation: 16:00 (what it thinks is UTC) + 8 hours = 00:00 the next day.
Ubuntu automatically calibrates its time over the internet (NTP). Once the system boots and connects to the network, it notices: "Huh? The local time I calculated from the hardware clock (00:00) doesn't match the network standard time (16:00). It's 8 hours off."
So, Ubuntu does something clever:
- It automatically corrects the system time to the correct network time (16:00).
- At the same time, to keep things consistent in the future, it uses this corrected UTC to update the hardware clock.
- At this point, the number in the hardware clock is changed by Ubuntu from 16:00 to 08:00.
Step 3: Reboot and switch back to Windows (time is wrong)
Reboot the computer again and go back to Windows.
- Windows reads the hardware clock, and it still thinks the hardware clock stores local time. So it reads 08:00.
- When Windows can't automatically calibrate over the network at startup, you'll need to set it manually, so it just displays this time as 8:00 AM local time.
The Tale of Dual-Boot Time Confusion
The Tale of Dual-Boot Time Confusion