Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to solve the problem of display time error in Windows-Linux dual boot setting

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "how to solve the problem of display time error in Windows-Linux dual boot setting". The explanation in this article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to solve the problem of display time error in Windows-Linux dual boot setting".

If you dual-boot Windows and Ubuntu or any other Linux distribution, you may notice the time difference between the two operating systems.

When you use Linux, it shows the correct time. But when you enter Windows, it shows the wrong time. Sometimes, on the contrary, the Linux shows the wrong time, while the Windows time is correct.

It is particularly strange because you are connected to the Internet and have set the date and time to be used automatically.

Don't worry! You're not the only one with this problem. You can solve this problem by using the following command on the Linux terminal:

Timedatectl set-local-rtc 1

Again, don't worry. I will explain why you encounter a time lag in the dual boot setting. I'll show you how the above command fixes the time error after Windows dual boot.

Why do Windows and Linux show different times on dual booting?

A computer has two main clocks: the system clock and the hardware clock.

The hardware clock is also called RTC (real-time clock) or CMOS/BIOS clock. The clock is outside the operating system, on the motherboard of the computer. Even after your system shuts down, it will continue to run.

The system clock is what you see in the operating system.

When the computer starts up, the hardware clock is read and used to set the system clock. After that, the system clock is used to track time. If your operating system makes any changes to the system clock, such as changing the time zone, it will try to synchronize this information to the hardware clock.

By default, Linux believes that the time stored in the hardware clock is UTC, not local time. On the other hand, Windows believes that the time stored on the hardware clock is local time. This is the beginning of the problem.

Let me explain it with an example.

You see, I'm in the UTC+5:30 time zone in Calcutta. After installation, when I set the time zone in Ubuntu to the Calcutta time zone, Ubuntu synchronizes this time information to the hardware clock, but there is a 5:30 offset because it has to be UTC for Linux.

Suppose the current time in the Calcutta time zone is 15:00, which means that the UTC time is 09:30.

Now when I shut down the system and boot to Windows, the hardware clock has UTC time (09:30 in this case). But Windows believes that the hardware clock already stores local time. Therefore, it changes the system clock (which should be displayed as 15:00) and uses the UTC time (09:30) as the local time. Therefore, the Windows shows the time as 09:30, which is 5:30 earlier than the actual time (15:00 in our example).

Similarly, do you know what would happen if I set the correct time in Windows through the automatic time zone and time button? Now it will display the correct time (15:00) on the system and synchronize this information (note the "synchronize your clock" option in the picture) to the hardware clock.

If you boot to Linux, it reads the time from the hardware clock, which is the local time (15:00), but because Linux thinks it is UTC time, it adds an offset of 5:30 to the system clock. Now the time shown by Linux is 20:30, which is 5:30 later than the actual time.

Now that you understand the root cause of jet lag in dual booting, it's time to see how to solve the problem.

Fixed an issue where Windows displayed the wrong time in Linux dual boot settings

There are two ways to deal with this problem:

Let Windows use the hardware clock as the UTC time

Let Linux use the hardware clock as the local time

It is relatively easy to make changes in Linux, so I recommend the second method.

Ubuntu and most other Linux distributions now use systemd, so you can use the timedatectl command to change the settings.

What you need to do is tell your Linux system to use the hardware clock (RTC) as the local time. You can do this through the set-local-rtc (set local time for RTC) option:

Timedatectl set-local-rtc 1

As shown in the following figure, RTC now uses local time.

Now if you start Windows, it treats the hardware clock as local time, which is actually correct. When you boot in Linux, your Linux system knows that the hardware clock uses local time, not UTC. Therefore, it does not attempt to add this time offset.

This solves the problem of time difference when Linux and Windows are started.

You will see a warning that RTC does not use local time. For desktop settings, it should not cause any problems. At least, I can't think of any problem.

Thank you for your reading, the above is the content of "how to solve the problem of display time error in Windows-Linux double boot setting". After the study of this article, I believe you have a deeper understanding of how to solve the problem of display time error in Windows-Linux double startup setting. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report