Skip to content

Instantly share code, notes, and snippets.

@Yemolai
Created April 12, 2021 00:11
Show Gist options
  • Save Yemolai/70ad9bdf457b7b6dc375bcf9c5bc17a3 to your computer and use it in GitHub Desktop.
Save Yemolai/70ad9bdf457b7b6dc375bcf9c5bc17a3 to your computer and use it in GitHub Desktop.

from: https://ourcodeworld.com/articles/read/1063/how-to-fix-time-modification-on-your-computer-with-dual-boot-windows-10-and-ubuntu-18-04

How to fix time modification on your computer with dual boot (Windows 10 and Ubuntu 18.04)

FEBRUARY 09 2020

Since i decided to work with dual boot for having an Ubuntu machine with optimal performance, instead of using virtual machines, i noticed that when i started using the computer with Ubuntu and then decided to boot with windows, the timezone of Windows changed automatically, so i needed to fix this everytime i used both operative systems on the same day.

After some research, i discovered what was causing the issue. Apparently, Ubuntu keeps the hardware clock in universal time (UTC), while windows keeps the clock in local time, causing a conflict between the mentioned operative systems.

The solution for this is either force Ubuntu to maintain the realtime clock in local time or force Windows to use UTC. You may decide which solution fits better with your needs.

A. Disable UTC and use Local Time in Ubuntu

To force ubuntu to use the local time, open a new terminal and type the following command:

timedatectl set-local-rtc 1 --adjust-system-clock

After running the command, you should be able to check whether the system is using the local time or not with the following command:

timedatectl

This should show Ubuntu using local time:

Local time: dom 2021-04-11 21:08:13 -03   
           Universal time: seg 2021-04-12 00:08:13 UTC   
                 RTC time: seg 2021-04-12 00:08:13       
                Time zone: America/Sao_Paulo (-03, -0300)
System clock synchronized: yes                           
              NTP service: active                        
          RTC in local TZ: yes  

Finally just restart the PC and switch to Windows, adjust the system clock time again with the correct time and that's it ! The problem should be solved. Personally, i used this option as you need to run a single command only and that's it.

B. Force Windows to use UTC

As first, boot into Windows 10 and as soon as it boots, launch the Command Prompt in Administrator mode. When the console shows up, run the following command if you have a 32 Bits version of Windows (Reg DWORD entry):

Reg add HKLM\SYSTEM\CurrentControlSet\Control\TimeZoneInformation /v RealTimeIsUniversal /t REG_DWORD /d 1

If you have a 64 Bits version of Windows, run the following command instead (Reg QWORD entry):

Reg add HKLM\SYSTEM\CurrentControlSet\Control\TimeZoneInformation /v RealTimeIsUniversal /t REG_QWORD /d 1

The commands basically create a new entry in the registry of Windows specifically in the HKLM\SYSTEM\CurrentControlSet\Control\TimeZoneInformation key. Defining the RealTimeIsUniversal property with a value of 1. You can do this manually as well if you prefer using regedit.

Finally reboot your system, adjust the system clock time again with the correct time and that's it! The time shouldn't be a problem anymore when using dual boot of Ubuntu 18.04 and Windows 10.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment