Windows–Linux dual-booters: how to set Windows system time to UTC

This is for people who dual-boot Windows and GNU/Linux.

 If you use both OSs on the same machine, you may have run into an issue with the time display when you switch between GNU/Linux and Windows. If your time is correct in GNU/Linux, it may be off by some number of hours (depending on your time-zone) in Windows (or vice-versa). This is because (by default) Linux sets the system (hardware) clock to UTC (Universal Time Coordinated) while Windows sets it to your LOCAL time. Traditionally, many (but not all) Linux distributions have provided a work-around so your GNU/Linux distribution can set the system (hardware) clock in accordance with how Windows does things. If, when you installed your GNU/Linux OS, you were asked which of two times is the correct one, you are probably all set, and you do not need to read any further (unless you are curious).

 On the other hand, if you were not asked the above question, what I have to say here may be of help.

 There are three ways to change how the two OSs interact regarding the setting of the system (hardware) clock’s time setting. I have tested all three of the methods I describe below, and they all work correctly on my computer.

 Configure GNU/Linux to set the System (hardware) Clock to your local time:

 If /etc/adjtime exists on your GNU/Linux installation (mostly Debian/Ubuntu based distributions), you can easily make it conform to Windows system (hardware) clock configuration.

 First, make sure /etc/adjtime exists. Open your GNU/Linux distribution’s file manager and navigate to the /etc directory. Scroll down past the list of sub-directories and look for the adjtime file. If the file exists, open it with your distribution’s text editor (you can usually double-click the file name). If the bottom line contains “LOCAL”, you’re all set. Close the text editor and the file manager. You’re good to go and you don’t need to make any changes to either OS.

 On the other hand, if the bottom line contains “UTC”, (or you are curious), read on . . .

 Open a terminal emulator (Bash command prompt) window.

 Enter:

    sudo nano /etc/adjtime <ENTER>

 The nano text editor will open in the terminal emulator and display the contents of the /etc/adjtime file. Your cursor will be at the start of the top line of the file. Because this is a command line editor, you cannot use your mouse – at all.

 Use the down-arrow key on your keyboard to navigate to the start of the last (bottom) line in the file (contains “UTC” (no quotes).

 Use the Delete key to remove the UTC text, then replace it with LOCAL (all caps).

 To save your changes and exit nano, press the CTRL+X key combination.

 You will be asked it you want to write your changes to the disk.

 Enter:

     Y <ENTER>.

 to confirm that you do. Your changes will be saved, and you will be returned to the bash command prompt.

 Enter:

     exit <ENTER>

 to close the terminal emulator.

 Windows and GNU/Linux will now play nicely with the time display.

 If you cannot, or do not want to configure GNU/Linux to conform to Windows’ use of Local time, you can configure Windows to conform to GNU/Linux’s use of Universal Time  Coordinated (UTC) with the simple addition of one registry key. There are two ways to add this key, using the Windows Registry Editor, or using an Administrative Command Prompt. I will describe both methods below:

Configure Windows to set the system (hardware) clock to UTC (Universal Coordinated Time):

Before making any change to the Windows Registry, create a System Restore Point (or create a system image with the back-up utility of your choice), just in case something bad happens (power failure, etc.).

Using the Registry Editor:

Press the Win-Key+R key combination to open the run dialog.

 Enter:

     regedit <ENTER> (opens the registry editor)

 In the registry editor, navigate to:

 “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation”

 Alt-click your mouse in an empty part of the main (right) pane (if you are right-handed, that’s a right-click) and in the pop-up dialog select New –> DWORD (32-bit Value).

 A new highlighted text entry box will open.

 Enter:

     RealTimeIsUniversal <ENTER> (creates and names the new registry key)

 Double-Click your new entry (RealTimeIsUniversal) and change its value to 1.

 Press the OK button to save the change.

 Close the registry editor.

Using an Administrative Command Prompt:

Press the Win-Key+R key combination to open the run dialog.

 Enter:

     cmd

 Press Ctrl+Shift+Enter to open the Command Prompt window as an Administrator.

 Enter (all on a single line):

 “reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation" /v RealTimeIsUniversal / d 1 /t REG_DWORD /f”

 Press:

     <ENTER> (executes the command)

 This command creates the new registry key “RealTimeIsUniversal” at the same registry location (HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation) with the value of 1, the same as was done using the Registry Editor above.

 No mater which method you used, reboot the computer to make the new change take effect.

 After using one of the methods above, Windows and GNU/Linux will get along just fine – either they both set the system time clock to UTC (just like all the web sites we visit on the Internet), or if you subjugated GNU/Linux to the Windows paradigm, they both set it to local time.

I hope this helps,

Ernie


Comments

Popular posts from this blog

Common Debian App Commands With Descriptions

Here is what I do to remain safe on (and off) the Internet