If you have a computer where a Linux OS (e.g. Ubuntu) is dual-booted with Windows, you will notice that, every time you reboot from Linux to Window, clock time displaying incorrectly in Windows. Even some Linux may show incorrect time if you are returning from Windows. Here’s how to solve this.
To keep track of proper time, Operating Systems make use of BIOS time settings from your computer’s motherboard. Because BIOS has the ability to keep running the clock even if your system is turned off (using CMOS memory and battery). Different Operating Systems may use different methods to store clock/time information in BIOS. For example, Unix and Linux based systems (e.g. Debian, Ubuntu, Mac, BSD, etc.) use “UTC” time format while Windows uses “Local time” format to write to BIOS clock settings. UTC (GMT) is better as you don’t have to change hardware time when you move to another timezone.
The problem happens when you install multiple Operating Systems with multi-boot procedure on same computer which shares same motherboard. As the same BIOS clock settin is used by all OS present on the computer, when you reboot from one to another, they read each other’s BIOS clock settings incorrectly. This is why your Windows or Linux is showing wrong time when switching from each other. However, Boot Camp in Mac system has fix for this.
To fix this problem, you need to change how an OS stores its clock data to BIOS. You should do it either from Windows side, or from Linux side. Not both!
Method 1: Linux Side Fix (Make Linux use “Local” Time)
We need to edit the file /etc/default/rcS and set UTC=no. You can do it normally by using any text editor or use following method if you have gedit installed.
- Open Terminal (press Ctrl+Alt+T for quick access) and type the following command and hit Enter.
sudo su root
- Type your password when it asks and hit Enter. This will give you root access.
- Now type the following command and hit Enter to open /etc/default/rcS file with gedit text editor.
- This will Open that rcS file in gedit. Notice “UTC” is set to “yes” there.
- Replace “yes” with “no” as following and click Save on toolbar.
- Close both gedit and Terminal. You are done!
On Fedora, openSUSE, ArchLinux, Some Debian versions: Replace the word UTC with the word LOCAL in /etc/adjtime file. In case the file doesn’t exist, create the file with following contents:
0.0 0 0.0
On Red Hat: Replace “UTC=true’‘ with “UTC=false” in “UTC” line of the file /etc/sysconfig/clock.
If you can’t find related file in your version of Linux Distro, check out clock/time configuration documentation page on your Operating System’s official site or try Windows side fix. However, many other factors are also involved regarding UTC vs Local preference in Linux clock system.
If you have more than one Linux OS installed on the same machine, make this change for all Linuxes.
Method 2: Windows Side Fix (Make Windows use “UTC” Time)
This fix is tested on Windows 10, Window 8.x, Windows 7 and Vista Service Pack 2. Any lower version of Windows will be supported.
- Press Windows+R key and type regedit and hit OK. This will open Windows Registry Editor.
- Navigate to the location HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation.
- From left side, right-click on TimeZoneInformation folder and then select New > DWORD (32-bit) Vlaue.
- Rename the new entry to RealTimeIsUniversal.
- Now double-click on the entry RealTimeIsUniversal and set Value data 1. Hit OK then.
- Close Registry Editor.
In case you want to revert this, simply delete the entry RealTimeIsUniversal.
Now the problem is “Windows Time service” will still write “local time” to hardware clock setting. So we need to disable it and prevent it from auto starting. To do so,
- Press Windows+R key and type service.msc and hit OK. This will open Windows Service manager.
- Locate Windows Time and double-click on it.
- Choose Disabled under Startup type and hit Apply.
- You are done!
Note: Syncing your Windows clock with internet using buit-in “Date and Time” settings will make “Window Time service” again start.Thus it will break your preference. Try to use a third-party tool to sync it.
You can always change these setting if you decide to keep Windows clock in local time.
If you have more than one Windows (such as Windows 10 and Windows 7) installed on same system, do this change for all Windows versions.
Again, use either Windows fix, or Linux. Not both.
Tell us how you managed to keep your both Window and Linux time accurate in your multi-boot computer.