Learn why the time of one operative system changes when you switch from operative system (from ubuntu to windows and viceversa).

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 will generate the following output in the terminal:

Ubuntu using local time

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.


Senior Software Engineer at Software Medico. Interested in programming since he was 14 years old, Carlos is a self-taught programmer and founder and author of most of the articles at Our Code World.

Sponsors