Fix Time Sync Issue When Dual Booting Ubuntu Windows
In this article
When you dual boot Ubuntu and Windows, you'll often notice the clock is wrong in one OS after using the other. The cause is that Windows stores the hardware clock as local time, while Ubuntu (and most Linux systems) stores it as UTC. This guide fixes it by making both systems agree on the same clock standard. The safest and most common fix is to make Windows use UTC, which requires a quick registry edit. Alternatively, you can make Ubuntu use local time, which is simpler but can cause issues with some Linux services. We'll cover both methods, with the registry method first as it's the recommended approach.
What You'll Need
- Administrator access to Windows (to edit the registry)
- Sudo access in Ubuntu (for terminal commands)
- Both operating systems installed and bootable
Step-by-Step
Method 1: Make Windows Use UTC (Recommended)
- Boot into Windows.
- Press Windows + R, type
regedit, and press Enter. If prompted by User Account Control, click Yes. - Navigate to
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation. - Right-click on the right pane, select New > DWORD (32-bit) Value.
- Name it
RealTimeIsUniversal. - Double-click the new value and set its data to
1. Make sure the base is Hexadecimal (it should be by default). Click OK. - Close the registry editor.
- Restart Windows and boot into Ubuntu.
- Open a terminal in Ubuntu and run the following command to update the hardware clock to UTC:
sudo timedatectl set-local-rtc 0 - Then run
sudo hwclock --systohc --utcto sync the system clock to the hardware clock in UTC. - Reboot into Windows and check the time. It should be correct now.
Method 2: Make Ubuntu Use Local Time (Alternative)
- Boot into Ubuntu.
- Open a terminal.
- Run
sudo timedatectl set-local-rtc 1. This tells Ubuntu to treat the hardware clock as local time. - Run
sudo hwclock --systohc --localtimeto write the current system time to the hardware clock as local time. - Reboot into Windows. The time should now be correct.
- Note: This method can cause issues with some Linux services that expect UTC, but for most desktop users it works fine.
Common Mistakes
- Forgetting to set the DWORD value to 1 – If you create the registry entry but leave it at 0, it won't work. Double-check the value data.
- Using the wrong registry path – The value must be under
TimeZoneInformation, not elsewhere. A typo in the path means the setting won't apply. - Not running the Ubuntu command after the registry edit – If you only change Windows but don't update Ubuntu's setting, the hardware clock may still be interpreted as local time by Ubuntu.
- Changing the time manually in one OS – After fixing, avoid manually changing the clock in one OS; let it sync automatically. Manual changes can re-introduce the offset.
- Assuming the fix works immediately – You need to reboot both systems at least once for the change to take full effect.
Tips
- After applying the fix, enable automatic time sync in both OSes. In Windows, go to Settings > Time & Language > Date & time and turn on “Set time automatically.” In Ubuntu, the system usually syncs via NTP if enabled (check with
timedatectl). - If you ever reinstall either OS, you'll need to reapply the fix. Keep the registry command handy.
- Use
timedatectlin Ubuntu to verify the current RTC setting. The output shows “RTC in local TZ: yes” or “no”. - If you use Windows Subsystem for Linux (WSL), it uses the Windows clock, so this fix also helps there.
Troubleshooting
If the time is still wrong after applying the steps, try these in order:
- Check the registry value – Boot into Windows, open regedit, and confirm
RealTimeIsUniversalexists and is set to 1. If it's missing, re-add it. - Verify Ubuntu's RTC setting – In Ubuntu, run
timedatectl. If it says “RTC in local TZ: yes” and you used Method 1, runsudo timedatectl set-local-rtc 0again. - Sync the hardware clock manually – In Ubuntu, run
sudo hwclock --systohc --utc(for Method 1) or--localtime(for Method 2). Then reboot. - Disable automatic time sync temporarily – Sometimes Windows' automatic sync can override the hardware clock. Turn off “Set time automatically” in Windows, reboot, and see if the time stays correct. If it does, you can turn it back on after a few minutes.
- Check for other OSes – If you have more than two OSes, ensure they all use the same RTC standard. For example, macOS also uses UTC, so it aligns with Ubuntu.
- If nothing works – Try the opposite method. If you used Method 1, switch to Method 2. Sometimes a specific hardware or firmware quirk makes one method more reliable.
Frequently Asked Questions
Why does the time go wrong only after switching between OSes?
Because each OS writes its own interpretation of the hardware clock. Windows assumes it's local time, Ubuntu assumes UTC. When you boot the other OS, it reads the clock and adjusts it, causing the offset.
Is the registry edit safe?
Yes, it's a standard Microsoft-supported setting. It only affects how Windows interprets the hardware clock. As long as you follow the steps, it's safe. Always back up the registry before editing if you're cautious.
Will this affect my files or programs?
No. It only changes how the system clock is read. Your files and programs are unaffected. However, if you have scheduled tasks that rely on time, they might shift by the timezone offset until the fix is applied.
Can I use both methods at the same time?
No. You should pick one. Using both would cause the same conflict. Choose either Windows UTC or Ubuntu local time, not both.
What if I have a third OS like macOS?
macOS also uses UTC, so if you set Windows to UTC, it will work with macOS too. If you use the Ubuntu local time method, you'd need to change macOS as well, which is more complex.
Does this fix work on all dual-boot setups?
Yes, it works for any dual boot of Windows and Ubuntu, regardless of whether you use UEFI or legacy BIOS. The hardware clock is the same.