Windows and linux time dual boot

Fix Windows 10 showing wrong time in dual boot with Linux

If you have installed Linux alongside windows in the dual boot you might have noticed that every time you boot Windows after using Linux it shows the wrong time. And sometimes opposite also happens Linux shows the wrong time when booted into after using Windows. This wrong time in Windows in dual boot system has a very simple fix just continue reading the article.

This might make you feel strange since your system is connected to the internet and the Automatically update time is also turned on. But still, your system shows the wrong time in one of the OS in dual boot.

Don’t worry you are not the only one to face this issue. This issue is pretty common and is caused due to understanding difference between the Linux and Windows.

If you just want a quick fix for the wrong time in Windows and Linux dual boot system, run the below command in the Linux distro terminal. And this will fix it.

timedatectl set-local-rtc 1

There is also another way to fix it, using which you can fix this from Windows only. But first, let’s understand why you see a time difference every time you boot from one OS after another.

Why Windows show the wrong time after booting into Linux?

Time in the computer is stored not in the OS but on the hardware clock called CMOS or BIOS clock. This clock is present on the motherboard of the system. This clock stores time even after the system is unplugged. And this clock is the reason why your system shows the right time every time even when it’s not connected to the internet.

Then there is another clock in the OS that does not store time but at every boot reads the time from this CMOS or BIOS clock. After the boot, the OS clock tracks the time and keeps it updated and right on time. In case of any change, it also updates the time on the system’s hardware clock. This system is almost perfect in itself if used with any one operating system.

But the problem arises when we use both Windows and Linux operating systems on the same machine. As clock present on both the operating system uses a different timezone while reading the time from the hardware clock.

Now let’s see how and why this happens. Suppose you booted your Linux OS after the first boot, you set your time zone, which adjusts the time on the clock of your Linux OS. Now as the Linux clock is updated, it also updates the time on the system’s hardware clock. And by default for Linux OS, the system’s hardware clock is in UTC. Due to this in whatever time zone you are Linux changes the hardware clock time to match it in UTC.

Читайте также:  Линукс только командная строка

Let’s Understand this with an example

For example, I am here in the time zone UTC+5.30 which is the time zone of Kolkata and the time right now is 13:00. Now when I am using Linux it updates the hardware clock to UTC time, which means 07:30. Now when I restart the system and boot into Windows, it reads the hardware clock time which is in UTC but Windows uses local time zone so it considers it as local time and updates OS’s clock. Due to which even though the actual time is 13:00 Windows will show 07:30.

This problem is caused due to both the operating system using different time zone to read and store the time on the hardware clock.

Sometimes even the opposite can happen. For example, I now updated my Windows clock time to the actual time of 13:00. Then Windows will also update the time on the hardware clock and will make it 13:00 as it uses the local time zone. Now if I restarted my machine and booted Linux it will read hardware clock time considering its UTC. And since my time zone is UTC+5.30 Linux will update its clock timing to 18:30 (Neglecting the time required to restart here). And if I manually update the time or click on sync time in Linux, it will make the time correct in Linux but will change the time on the hardware clock, and this way this cycle continues.

How to Fix this time difference in Windows and Linux in dual boot system?

Now to fix this problem all you need to do is make both operating systems read time in a similar timezone be it UTC or local. For this, all you need to do is to run a single command below in Linux.

timedatectl set-local-rtc 1

Fix Wrong time in WIndows in dual boot alongside Linux

This command tells Linux that to use in local time for hardware clock. And it will fix the miscommunication between Windows and Linux. This command will fix the wrong time after boot in the WIndows and Linux dual boot system.

If you want you can also fix this issue from Windows by telling Windows to use the UTC time for the hardware clock. Although changing it in Linux is recommended.

How to make Windows use UTC

To make Windows use UTC time to for hardware clock you need to edit the Windows registry.

Note: The Windows Registry Editor is a powerful tool and misusing it can render your system unstable or even non-working. That's why its recommended to make Linux use local time zone to fix this issue.

If you still want to make changes to Windows to use UTC here is how to do it.

Solved Wrong time in dual boot system

First, open Regedit by searching for regedit in the Windows search bar or by clicking on the start icon and then searching for it. Now click on regedit to open it and accept the security prompt that will appear. Then in regedit navigate to the below location using the left panel.

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation

Fix wrong time in WIndows

Right-click on the TimeZoneInformation key and select New, in it, select the DWORD (32-bit) Value. In that type RealTimeIsUniversal for your new value name.

Читайте также:  Linux отобразить все процессы

Fix time difference in Windows and Linux in dual boot system

Now double click on the new value you created and in the Value data option enter 1 and then click on OK.

It’s done now you can close the Windows registry editor. Now Windows will also store and read time in UTC from the hardware clock just like Linux. This will fix the wrong time issue while dual-booting Windows and Linux.

Conclusion:

In this article, we saw how we can fix the common problem of wrong time when using Windows and Linux in dual boot. Which is caused due to Windows and Linux both using different time zones to read and store the time on the system hardware clock. I hope this helps thanks for reading till last.

Источник

Wrong Time Displayed in Windows-Linux Dual Boot Setup? Here’s How to Fix it

If you dual boot Windows and Linux, you’ll notice that often one of them shows incorrect time. Here’s why that happens and what you can do to fix it.

If you dual boot Windows and Ubuntu or any other Linux distribution, you might have noticed a time difference between the two operating systems. When you use Linux, it shows the correct time. But when you boot into Windows, it shows the wrong time. Sometimes, it is the opposite and Linux shows the wrong time and Windows has the correct time. That’s strange specially because you are connected to the internet and your date and time is set to be used automatically. Don’t worry! You are not the only one to face this issue. You can fix it by using the following command in the Linux terminal:

timedatectl set-local-rtc 1

Again, don’t worry. I’ll explain in detail how the above command fixes the wrong time issue in Windows after dual boot. But before that, let me tell you why you encounter a time difference in a dual boot setup.

Why Windows and Linux show different time in dual boot?

set time windows

A computer has two main clocks: a system clock and a hardware clock. A hardware clock which is also called RTC (real time clock) or CMOS/BIOS clock. This clock is outside the operating system, on your computer’s motherboard. It keeps on running even after your system is powered off. The system clock is what you see inside your operating system. When your computer is powered on, the hardware clock is read and used to set the system clock. Afterwards, the system clock is used for tracking time. If your operating system makes any changes to system clock, like changing time zone etc, it tries to sync this information to the hardware clock. By default, Linux assumes that the time stored in the hardware clock is in UTC, not the local time. On the other hand, Windows thinks that the time stored on the hardware clock is local time. That’s where the trouble starts. Let me explain with examples. You see I am in Kolkata time zone which is UTC+5:30. After installing, when I set the timezone in Ubuntu to the Kolkata time zone, Ubuntu syncs this time information to the hardware clock but with an offset of 5:30 because hardware clock (RTC) has to be in UTC for Linux. Let’ say the current time in Kolkata timezone is 15:00 which means that the UTC time is 09:30. Now when I turn off the system and boot into Windows, the hardware clock has the UTC time (09:30 in this example). But Windows thinks the hardware clock has stored the local time. And thus it changes the system clock (which should have shown 15:00) to use the UTC time (09:30) as the local time. And hence, Windows shows 09:30 as the time which is 5:30 hours behind the actual time (15:00 in this example). Again, if I set the correct time in Windows by toggling the automatic time zone and time buttons, you know what is going to happen? Now it will show the correct time on the system (15:00) and sync this information (notice the “Synchronize your clock” option in the image) to the hardware clock. If you boot into Linux, it reads the time from the hardware clock which is in local time (15:00) but since Linux believes it to be the UTC time, it adds an offset of 5:30 to the system clock. Now Linux shows a time of 20:30 which is 5:30 hours ahead of the actual time. Now that you understand the root cause of the time difference issues in dual boot, it’s time to see how to fix the issue.

Читайте также:  Install package on oracle linux

Fixing Windows Showing Wrong Time in a Dual Boot Setup With Linux

  1. Make both Ubuntu and Windows check for date, time and timezone automatically via internet
  2. Make Linux use local time for the hardware clock
  3. Make Windows use UTC time for the hardware clock

I’ll discuss two of them which are easier.

Method 1: Make your OS set time and date automatically

What happens in this case is that though your operating system (be it Windows or Linux) will show the incorrect time for a minute, and then it automatically sets the correct time if you are connected to the internet.

To make your Ubuntu Linux system check for date and time automatically, go to System Settings -> Date & Time and enable both options.

set auto time date timezone ubuntu

You should do a similar settings change for Windows as well.

Method 2: Make Ubuntu use local time for hardware clock

It is easier to make the changes in Linux and hence I’ll recommend going with the second method.

Ubuntu and most other Linux distributions use systemd these days and hence you can use timedatectl command to change the settings.

What you are doing is to tell your Linux system to use the local time for the hardware clock (RTC). You do that with the set-local-rtc (set local time for RTC) option:

timedatectl set-local-rtc 1

As you can notice in the image below, the RTC now uses the local time.

Set local time for RTC in Ubuntu

Now if you boot into Windows, it takes the hardware clock to be as local time which is actually correct this time. When you boot into Linux, your Linux system knows that the hardware clock is using local time, not UTC. And hence, it doesn’t try to add the off-set this time.

This fixes the time difference issue between Linux and Windows in dual boot.

You see a warning about not using local time for RTC. For desktop setups, it should not cause any issues. At least, I cannot think of one.

I hope I made things clear for you. If you still have questions, please leave a comment below.

Источник

Оцените статью
Adblock
detector