110

I have dual booted Windows 10 and Ubuntu 16.04 in UEFI mode (secure boot off). My time in BIOS is correct.

When I boot into Ubuntu and then boot into Windows 10, it shows the wrong time. I have to correct it manually or by the internet in Windows 10, and when I reboot into Windows 10 then it is not a problem. The clock will show the correct time. And then when I reboot to Linux the clock is correct, but switching back to Windows 10 the clock messes up again.

karel
  • 114,770

1 Answers1

121

Multiple Boot Systems Time Conflicts

Operating systems store and retrieve the time in the hardware clock located on your motherboard so that it can keep track of the time even when the system does not have power. Most operating systems (Linux/Unix/Mac) store the time on the hardware clock as UTC by default, though some systems (notably Microsoft Windows) store the time on the hardware clock as the 'local' time. This causes problems in a dual boot system if both systems view the hardware clock differently.

The advantage of having the hardware clock as UTC is that you don't need to change the hardware clock when moving between timezones or when Daylight Savings Time (DST) begins or ends as UTC does not have DST or timezone offsets.

Changing Linux to use local time is easier and more reliable than changing Windows to use UTC, so dual-boot Linux/Windows systems tend to use local time.

Since Intrepid (8.10), UTC=yes is default.

Solution 1: Make Windows use UTC

Note: This method was not initially supported on Windows Vista and Server 2008, but came back with Vista SP2, Windows 7, Server 2008 R2 and Windows 8/8.1.

To make MS Windows calculate the time from the hardware clock as UTC.

Create a file named WindowsTimeFixUTC.reg with the following contents and then double click on it to merge the contents with the registry:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation]
 "RealTimeIsUniversal"=dword:00000001

Note: Windows Time service will still write local time to the RTC regardless of the registry setting above on shutdown, so it is handy to disable Windows Time service with this command (if time sync is still required while in Windows use any third-party time sync solution):

sc config w32time start= disabled

If running the above command in Powershell, you'll have to specify sc.exe:

sc.exe config w32time start= disabled

Reversing the change

You can create a file with the following contents and then double-click it to merge in the original changes, as above:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation]
 "RealTimeIsUniversal"=-

If Windows Time service was disabled, enable it again with the command:

sc config w32time start= demand

Solution 2: Make Linux use 'Local' time

To tell your Ubuntu system that the hardware clock is set to 'local' time:

Pre-Ubuntu 15.04 systems (e.g. Ubuntu 14.04 LTS):

  1. edit /etc/default/rcS
  2. add or change the following section

    # Set UTC=yes if your hardware clock is set to UTC (GMT)
    UTC=no
    

Ubuntu 15.04 systems and above (e.g. Ubuntu 16.04 LTS):

  1. open a terminal and execute the following command

    timedatectl set-local-rtc 1
    

source: Ubuntu Help

Garrett Simpson
  • 147
  • 1
  • 10
Ceda EI
  • 2,070
  • Hi, have you try this on Windows 10 64bit also? There should be used not "dword" but "qword". Source: http://ubuntuhandbook.org/index.php/2016/05/time-differences-ubuntu-1604-windows-10/ – Matěj Kříž Apr 25 '17 at 16:14
  • I had tried it on Windows 10 a year ago.... This worked then ... Can't say about now however, it most probably will work – Ceda EI Apr 25 '17 at 17:45
  • Is it safe/ok to disable Windows Time service? What does it do? If it disables time internet sync than it would be bad to disable it – user25 May 23 '18 at 18:37
  • I have a dual boot setup with Windows 10 and Ubuntu 20.04. Before doing anything, Ubuntu would display the clock correctly and Windows would display a wrong clock. Making Windows use UTC and turning off the Windows time service didn't work, it made Windows display the right time while Ubuntu displayed a wrong one. But making Ubuntu use local time made both display the same correct time. – Hatchi Roku Jul 28 '20 at 09:42
  • i have the same problem but i noticed that Bios has the wrong time that the windows10 displays (only after i had previously booted in Linux). I tried changing the Bios time but when i go back it's the false one every time.... – Panagiss Oct 16 '20 at 08:51
  • Should this change the time instantly? My time is off by an hour after using Windows 10 but timedatectl set-local-rtc 1 or timedatectl set-local-rtc 0 does not make any difference. – Kvothe Feb 17 '21 at 11:26