Students using a dual system of Windows and Ubuntu have encountered an interesting problem: the dual system time is not synchronized, and after switching from Linux back to Windows, it is exactly 8 hours slow.
This is actually because Windows and Linux interpret the hardware clock (RTC) time differently. Our motherboard has a clock chip that stores the physical world time, but Windows believes that the time stored in the hardware clock should be local time (for example, if your time zone is UTC+8, the hardware clock should show Beijing time). Linux/Ubuntu believes that the time stored in the hardware clock should be UTC (Coordinated Universal Time).
Assuming your time zone is UTC+8 (Beijing time). The real-world time is 4 PM (16:00) Beijing time (local time), which corresponds to 8 AM (08:00) UTC.
Step 1: In Windows#
-
While using Windows, the system time correctly displays as 16:00 (4 PM).
-
Windows believes that the hardware clock should store local time. Therefore, it writes the time 16:00 into the hardware clock.
Step 2: Restart and enter Ubuntu#
-
Boot the computer and enter Ubuntu.
-
Ubuntu reads the hardware clock, and it defaults to assuming that the time stored in the hardware clock is UTC time. So it reads 16:00.
-
Ubuntu thinks: “Oh, the hardware clock says the UTC time is 16:00. Since my time zone 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 performs network time synchronization (NTP) over the internet. When the system starts and connects to the network, it finds: “Huh? The local time (00:00) calculated from the hardware clock does not match the network standard time (16:00), it is off by 8 hours.”
Thus, Ubuntu does something clever:
- It automatically corrects the system time to the correct network time (16:00).
- At the same time, to maintain future consistency, 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: Restart and switch back to Windows (time error)#
Restart the computer again and return to Windows.
- Windows reads the hardware clock, and it still believes that the time stored in the hardware clock is local time. So it reads 08:00.
- When Windows cannot automatically connect to the internet for calibration at startup, manual calibration is required, so it directly displays this time as local time at 8 AM.
This article is synchronized and updated to xLog by Mix Space The original link is https://fmcf.cc/notes/18