Now, I have my PC in dual boot with Windows 10 and Ubuntu 20.04. Every time I exit Ubuntu and start Windows 10 it shows the wrong time. Something like 3 hours less than local time. So, I have to wait for initialization in order to synchronize with the Windows time server manually. The worst thing is that when I go back to Ubuntu, I have to resync the clock again. I would like the clock to work on both operating systems. What can I do to solve this problem? Thanks in advance.
2 Answers
Introduction
Dual booting is a common practice among computer users who want to use multiple operating systems on a single machine. However, one of the common problems that arise when dual booting with Windows 10 and Ubuntu is the issue of time synchronization. Every time a user switches between the two operating systems, the clock changes, causing inconvenience and frustration. In this blog post, we will discuss how to stop Windows 10 from changing the clock when dual booting with Ubuntu.
Understanding the problem
The problem of time synchronization arises because of the way Windows and Linux handle time differently. Windows uses local time as the system clock, while Linux uses Coordinated Universal Time (UTC) as the system clock. When a user switches from Ubuntu to Windows, Windows assumes that the system clock is set to local time and adjusts it accordingly. This causes the time in Windows to be off by a few hours. When the user switches back to Ubuntu, the system clock is set to UTC, causing the time to be off by a few hours again.
Solution 1: Set Windows to use UTC as the system clock
The first solution to the problem is to set Windows to use UTC as the system clock instead of local time. This can be done by editing the Windows registry. Here are the steps to follow:
1. Press the Windows key + R to open the Run dialog box.
2. Type regedit and press Enter to open the Registry Editor.
3. Navigate to the following key: HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlTimeZoneInformation
4. Right-click on an empty space in the right pane and select New > DWORD (32-bit) Value.
5. Name the new value RealTimeIsUniversal and set its value to 1.
6. Click OK and close the Registry Editor.
After making these changes, Windows will use UTC as the system clock, which will prevent it from changing the clock when dual booting with Ubuntu.
Solution 2: Set Ubuntu to use local time as the system clock
The second solution to the problem is to set Ubuntu to use local time as the system clock instead of UTC. This can be done by editing the /etc/default/rcS file. Here are the steps to follow:
1. Open a terminal window in Ubuntu.
2. Type sudo nano /etc/default/rcS and press Enter.
3. Locate the line that reads UTC=yes and change it to UTC=no.
4. Press Ctrl + X to exit nano and press Y to save the changes.
5. Restart Ubuntu for the changes to take effect.
After making these changes, Ubuntu will use local time as the system clock, which will prevent it from changing the clock when dual booting with Windows.
Solution 3: Use a third-party tool
The third solution to the problem is to use a third-party tool to synchronize the clock between Windows and Ubuntu. One such tool is called NTP (Network Time Protocol). Here are the steps to follow:
1. Open a terminal window in Ubuntu.
2. Type sudo apt-get install ntp and press Enter to install NTP.
3. Once the installation is complete, type sudo nano /etc/ntp.conf and press Enter.
4. Locate the line that reads server 0.ubuntu.pool.ntp.org and add a # symbol at the beginning of the line to comment it out.
5. Add the following lines below the commented line:
server 0.pool.ntp.org
server 1.pool.ntp.org
server 2.pool.ntp.org
server 3.pool.ntp.org
6. Press Ctrl + X to exit nano and press Y to save the changes.
7. Restart NTP by typing sudo service ntp restart.
8. In Windows, download and install a third-party tool called NTP Time Zone Clock. This tool will synchronize the clock between Windows and Ubuntu.
After following these steps, the clock will be synchronized between Windows and Ubuntu, and the problem of time synchronization will be solved.
Conclusion
Dual booting with Windows 10 and Ubuntu can be a challenging task, especially when it comes to time synchronization. However, by following the solutions outlined in this blog post, users can easily prevent Windows from changing the clock when dual booting with Ubuntu. Whether you choose to set Windows to use UTC as the system clock, set Ubuntu to use local time as the system clock, or use a third-party tool like NTP, the problem of time synchronization can be easily solved.
This problem usually occurs when Windows and Ubuntu are handling hwclock differently, either: local time or UTC. The problem occurs because Unix-based systems usually treat hwclock as UTC, while Windows systems set it to local time.
One solution would be to make Ubuntu use local time, so the hwclock will not be changed. On the other hand, it is also possible to make Windows work in UTC, which would make your hardware clock (BIOS) run in UTC all the time.
To make Ubuntu use local time
For Ubuntu 15.04 or above, open the terminal and enter the following command:
timedatectl set-local-rtc 1 --adjust-system-clock
For versions prior to Ubuntu 15.04
Edit the file (edit /etc/default/rcS ) and add the following section:
#Set UTC=yes if your hardware clock is set to UTC (GMT) UTC=no
To make Windows use UTC
Note: This method is compatible with Vista SP2, Windows 7, Server 2008 R2 and Windows 8/8.1 or above.
You will need to have Windows calculate your timezone time from the hardware clock that will be configured in UTC. This can be done through an entry in the Windows registry. To do so, create a file called “WindowsSetClockToUTC.reg” (you can change this name, if you want) and add the following lines as its contents:
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation] "RealTimeIsUniversal"=dword:00000001
After saving the file, double click to run it. Thus, its contents will be merged with the Windows registry.
If there is any third-party software running time synchronization, you can shutdown “Windows Time Service” using the following command:
sc config w32time start= disabled
If for any reason you want to reverse the procedure, you can create a file with the following contents to override the settings above. Double click on file to merge the contents with the registry.
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation] "RealTimeIsUniversal"=-
Don’t forget that Windows Time Service was disabled, so turn it back on with the command:
sc config w32time start= demand
I hope this helps!