If you run a dual-boot setup with Ubuntu and Windows on the same computer, you have likely noticed that every time you reboot from one operating system into the other, your system clock is incorrect by several hours. This discrepancy is not a hardware fault or CMOS battery failure; it is caused by a fundamental disagreement between Windows and Linux regarding how the computer’s motherboard Real-Time Clock (RTC) is interpreted.
Why Dual-Boot Clocks Become Desynchronised
Your computer’s motherboard features a battery-backed physical chip known as the Real-Time Clock (RTC) or hardware clock. When your machine shuts down, the RTC continues keeping time. The conflict arises because the two operating systems interact with the RTC differently:
- Linux (Ubuntu): By default, modern Linux distributions store time in the hardware clock using Coordinated Universal Time (UTC). When Ubuntu boots, it reads the UTC value from the RTC and applies your local time zone offset (e.g., UTC+1 or UTC-5) purely in software.
- Microsoft Windows: By default, Windows assumes the hardware clock stores Local Time. When Windows boots, it assumes the hardware clock already reflects the time on your wall. When it adjusts the clock (or connects to an NTP server), it writes the local time directly into the physical RTC.
As a result, each operating system overwrites the motherboard clock upon shutdown or sync. If your time zone is 5 hours behind UTC, booting into Windows after Ubuntu will cause Windows to be 5 hours ahead; booting into Ubuntu after Windows will cause Ubuntu to apply the offset a second time, pushing the clock 5 hours behind.
Method 1: Make Ubuntu Use Local Time (Recommended & Simplest)
The cleanest, most reliable solution for everyday desktop users is instructing Ubuntu’s systemd-timedated service to interpret the hardware clock in local time. This prevents Ubuntu from modifying the RTC value that Windows expects.
- Boot into your Ubuntu desktop.
- Open the Terminal by pressing Ctrl + Alt + T.
- Check your current clock configuration by running:
You will seetimedatectlRTC in local TZ: no, indicating that UTC is currently active. - To switch the hardware clock to local time, execute the following command:
timedatectl set-local-rtc 1 --adjust-system-clock - Verify the updated configuration:
The output will now displaytimedatectlRTC in local TZ: yes, along with a brief informational warning explaining that local time RTC mode is active for dual-boot compatibility.
Reboot your computer into Windows, adjust the clock if necessary, and reboot back into Ubuntu. The time will now match perfectly between both environments.
Method 2: Make Windows Use UTC via Registry (Alternative)
If you prefer adhering to POSIX standards and want the motherboard clock to remain in pure UTC, you can configure Windows to interpret the RTC as UTC using a simple Registry key. This is particularly popular among server administrators.
- First, ensure Ubuntu is set back to UTC if you previously modified it:
timedatectl set-local-rtc 0 --adjust-system-clock - Boot into Windows 11 or Windows 10.
- Click the Start button, type
cmd, right-click Command Prompt, and select Run as administrator. - For a standard 64-bit Windows installation, copy and paste the following command into the prompt, then press Enter:
(Note: If you are using a 32-bit build of Windows, replacereg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation" /v RealTimeIsUniversal /t REG_QWORD /d 1 /fREG_QWORDwithREG_DWORD.) - Disable Windows from automatically updating the hardware clock over the network during sleep states to prevent conflicts:
sc config w32time start= demand - Restart Windows. Both operating systems will now treat the motherboard RTC as UTC.
How to Revert Changes if Needed
If you later remove your dual-boot installation and want to return Ubuntu to its standard factory configuration:
- Open a terminal in Ubuntu.
- Execute:
timedatectl set-local-rtc 0 --adjust-system-clock - Ubuntu will immediately resume writing UTC time to the hardware clock.
Aligning how Ubuntu and Windows read your motherboard’s hardware clock permanently cures the shifting time bug, ensuring that scheduled calendar notifications, file modification timestamps, and browser SSL certificates operate without clock-skew errors.