How To Fix Time Difference Between Ubuntu And Windows

Recently LinuxAndUbuntu reader raised an issue that he was having with his dual boot. When he restarts from Ubuntu to Windows, the time in Windows changes. Here is why it happens and how you can fix it easily from Ubuntu.

Why There Is Time Difference Between Ubuntu And Windows ?

The time in Windows changes due to the ways both systems differently stores the time in the hardware clock. Ubuntu stores the time in UTC while Windows in Local time  so when user restarts Windows any number of time, the time does not change but when the user restarts from Windows into Ubuntu and then restarts back into Windows, the hardware clock has stored the time in UTC and now Windows changes it into Local time which cause the issue.

Here Is How Time Difference Between Ubuntu And Windows Can Be Fixed

Time difference can easily be resolved by changing the time from UTC to Local in Ubuntu. To do this simply edit the “/etc/default/rcS” file and change “UTC=no” to “UTC=yes” (without quotes). Now Ubuntu will store time in hardware clock in Local time instead of UTC so there won’t be any conflictions between Ubuntu and Windows. To do this automatically, use the following command in terminal –

$ sudo sed -i ‘s/UTC=yes/UTC=no/’ /etc/default/rcS
Although setting up time in UTC is beneficial because you don’t need to change the hardware clock when moving between timezones.

Fixing Time Difference From Windows

The above was the solution to time difference from Ubuntu, now let’s see how to fix it from Windows –

First of all download the below registry file and double click it to install.


Download File

After extracting registry, run command prompt as an administrator and enter the following command –
sc config w32time start= disabled
You are done! Now reboot the system for changes to take effects.

Oracle Java JDK 9

Webupd8 Team is maintaining a PPA repository with installer scripts for the latest Java 8 and 9, that automatically downloads the Java archive from Oracle website and sets up everything for you.

1. Add the PPA.

Open terminal (Ctrl+Alt+T) and run the command:

sudo add-apt-repository ppa:webupd8team/java

Type in your password when it asks and hit Enter.


2. Update and install the installer script:

Run commands to update system package index and install Java installer script:

sudo apt update; sudo apt install oracle-java8-installer

You may replace oracle-java8-installer with oracle-java9-installer to install Java 9.

While the install process, you have to accept Java license to continue downloading & installing Java binaries.

Oracle Java License

3. Check the Java version

To check the Java version after installing the package, run command:

javac -version

check out java version

4. Set Java environment variables

The PPA also contains a package to automatically set Java environment variables, just run command:

sudo apt install oracle-java8-set-default

For Java 9, install the package oracle-java9-set-default instead.

Blog at

Up ↑