banner
Magneto

Magnetoの小屋

Magneto在區塊鏈上の小屋,讓我們的文章在互聯網上永遠熠熠生輝!!

Dual System Fun Facts

Students using a dual system of Windows and Ubuntu actually encounter an interesting problem: the time is not synchronized between the two systems, and when switching back from Linux to Windows, it is exactly 8 hours slow.

This is because Windows and Linux interpret the hardware clock (RTC) time differently. There is a clock chip on our motherboard 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), and the corresponding UTC time is 8 AM (08:00).

Step 1: In Windows#

  1. Using Windows, the system time correctly displays as 16:00 (4 PM).
  2. Windows believes the hardware clock should store local time. Therefore, it writes the time 16:00 into the hardware clock.

Step 2: Restart and enter Ubuntu#

  1. Boot the computer and enter Ubuntu.
  2. 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.
  3. 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.”
  4. Calculation: 16:00 (what it thinks is UTC) + 8 hours = 00:00 the next day.
  5. Ubuntu automatically performs network time synchronization (NTP) via the internet. When the system starts and connects to the network, it finds: “Huh? The local time I calculated from the hardware clock (00:00) does not match the network standard time (16:00), there is an 8-hour difference.”
    So, Ubuntu does something smart:
  • 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 network for calibration at startup, manual calibration is required, so it directly displays this time as local time 8 AM.

This article is synchronized and updated to xLog by Mix Space. The original link is https://fmcf.cc/notes/17

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.