Fixing incorrect clock / time settings while dual-booting Windows/Linux
So, I recently got my father to start to switch from Windows to GNU/Linux. The man is a serious privacy freak who knows Windows systems better than almost anyone who hasn't been formally trained.
Envision a hermit with long hair and a bushy beard who has spent years complaining about the state of privacy, governments and the like; you aren't far from the truth with that image.
In the light of Windows 10 becoming the main OS for Windows users, and Windows 7 users being pushed harder and harder to switch, he has been growing more and more curious about making the switch. He's currently dual-booting and isn't quite ready to make a total conversion yet, but he's getting there!
With that being said, an issue that he is facing, and that I know many others have faced when running a dual-boot system, is when they swap over to GNU/Linux for a while, and then boot back into Windows only to find that their clock is set at the wrong time!
The reason for this is because GNU/Linux (as well as other OS's like Mac OS X) use UTC (Coordinated Universal Time) and Windows does not. Because the two operating systems communicate with your hardware and system a little differently on this topic, there is always going to be that little bit of an issue....or is there?
The GNU/Linux Solution
The solution, or rather, multiple possible solutions, are all quite easily solved. My preferred method for this issue, is simply to make the GNU/Linux system use 'localtime' instead of UTC. To do this on any modern system using SystemD, use the following command:
sudo timedatectl set-local-rtc 1
And done. That was easy!
The Windows Solution
However, for those of you who are curious about what the Windows based solution would be, we need to create a .reg registry file. Open Notepad, and paste this into it:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation]
"RealTimeIsUniversal"=dword:00000001
Next, save that file as "WindowsTimeFix.reg" and exit Notepad. Then, navigate your file browser to wherever you saved the file we just made, and double click it. A box will pop up essentially asking if you want to proceed, tell it that you do.
Once that is done, you'll also want to disable Windows syncing the time. To do this, you'll want to go to your services application by clicking your start menu and typing "services.msc", and clicking "Services." Once there, scroll down until you find "Windows Time" and right click it, selecting "Properties." From here, you'll want to stop the process, and then disable it as well.
Or, run the command sc config w32time start= disabled from an elevated command prompt instead. To turn the Windows Time service back on at a later point in time, run the command sc config w32time start= auto instead.
Once Windows Time has been stopped and disabled and the registry key has been changed, your Windows will no longer have the time issue whenever you switch back and forth between GNU/Linux.
Note: There is no need to do both of these things, doing so would actually KEEP the problem alive. Please pick whichever solution you feel like doing, and do that one. Do not do both! That's it! Happy computing!
Setting any computer to localtime makes no sense. Computers (mostly laptops) move across timezone boundaries. And real (ie linux/unix) computers can have multiple users at once, and they can be remote. The smart way is to keep the hwclock (not the OS) in UTC and don’t adjust it (let ntpd do that). Travelers can run tzselect to change their individual TZ shell variable. The concept of localtime is nuts (Nepal, India, Newfoundland), as is its history.
https://en.wikipedia.org/wiki/Time_zone
Nobody can keep track of it, but software can, and is updated. Works under linux, MS is not only broken, they don’t even try.
Thankyou for this! Immense! Just for kicks im a hackintosh (main productivity) / windows 7 (games console) configuration.
Just in case for all you linux users there, if you have the right hardware, getting a hackintosh up and running is as simple as installing the os and running -one- application for all the drivers. The apple services (including the store) all work except for imessage so if you ever get mac hardware its seamless. There’s a full ecosystem of high quality apps, it took a good year to explore but i’m short of nothing coming from windows. It also plays games. Admitted its been a decade since i’ve used either kde or gnome but the windows environment doesn’t feel flaky.. the main bonus.
Hackintosh is very choosy about hardware though. For example, Intel Wifi Adapters are a no go. Neither is Nvidia+Intel Optimus, so as you said, if you have the right hardware…Which isn’t as broad as one could wish.
Anyway, glad you enjoyed the article!
Hey thanks for writing the article!
To your point, having the right hardware makes a difference (goes from the easiest os install you have ever done for any os to impossible weekends of screwing around).. but, the hardware it does support does not have to be expensive unlike the genuine custom stuff.
Eg, for a wifi adaptor its not worth your time finding drivers, but a $15US tp-link one works great.. same for graphics.. im sure the cheapest nivida card on the market will do fine.
In my experience the budget componets have a higher chance of working due to the lack of / generic chips included.
Good luck! The osx ecosystem is worth it ;)
It really sucks on my 2-in-1 tablet. Every time I switch to Android back to Windows, the time is changed.
Hello,
After many years of following developments at the always informative and often lively discussions at ghacks I finally have a question.
To learn a bit about Linux I am running Linux Mint 17.1 cinnamon 64bit on a USB3 thumb drive with persistance enabled using Yumi multiboot USB creator. This is plugged into a W7 Pro box. I can connect to the net and have d-loaded a few things from the linux repositories so that seems to work.
I have the same issue of Mint time being off rather than USA -5 hours, which I manually set each time I open Mint. However the setting won’t stick. It does remember the east coast zone part, but the time is always 4 hours late when opening Mint. (Say 3PM local v 11AM “linux” time)
I’ve tried to follow Mike’s directions to use local time using Systemd by right clicking the systemd folder and opening in terminal. There I type in “sudo timedatectl set-local-rtc 1” (without quotes) and hit enter but that just jumps down one line waiting for more instructions, and it won’t stick. So far closing Mint has not changed the computer’s time.
What am I doing wrong?
Thanks for any help.
basicuser,
https://forums.linuxmint.com/viewtopic.php?t=226779
According to this, on earlier versions of Linux Mint (Pre-Mint 18) you need to edit /etc/default/rcS
Check out post #2 on that thread and see if that helps you :)
OK, will be watching for the article. With the sudo command I’ll be able to get into a lot of trouble poking around Linux. :)
basicuser,
sudo is the command you use for just about everything that required elevated privileges :)
There is an article about sudo being posted in the near future, so stay tuned!
The simplified version is:
sudo = super user do.
anytime you need elevated privileges, preface your command with sudo.
gedit is just a text editor.
The command you used basically said “Open this file in the gedit text editor, with root”
hope that helps explain it a little more!
Mike,
Thank you for your time and knowledge.
“sudo gedit /etc/default/rcS” did the trick.
From the little I found on line there’s a lot of opinions but not much agreement on elevated rights.
Shut down Mint, rebooted and local time stuck. Lesson learned.
sudo nano /etc/default/rcS
or sudo gedit /etc/default/rcS
or sudo kate /etc/default/rcS
or sudo INSERTYOURFAVOURITEtexteditorHERE /etc/default/rcS
etc etc
Thanks. Thanks to your link, found my way to the file I need to edit. I’ll try that as soon as I figure out how to get elevated rights to be able to edit the rcS file permissions.
Which part of:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation]
“RealTimeIsUniversal”=dword:00000001
Do I copy and paste,… All of it? Maybe somehow highlighting the actual copy and paste part. SInce i’m a typical Windows user i’m always overly cautious making changes to registry because I cant foresee what could go wrong nor how to fix it. An error might make it “Explode!” Lol
You copy the whole thing. If you feel uncomfortable doing so, open the Registry Editor manually instead and navigate to the path to add the Dword manually.
Great, Thank You!
Not certain about this but I’ve read that you may need to use QWORD instead of a DWORD registry entry in a 64bit Windows 10.
Simply set the clock in Linux to local time in clock settings…no reason to have to resort to the command line. Also an ad-blocker, script blocker and Privacy Badger are a necessity in the web browser of choice in either OS.
I dual boot mint and win10 and both use system bios for time, never issue.
I have the same problem on a Mac with Win7 running under Bootcamp. I’ll try the Win registry solution and see what happens.
It works to coordinate Windows-on-a-Mac time as well. In the Win7 registry I created the new RealTimeIsUniversal Dword key, entered the value and checked that Windows Time was disabled.
I can enter a new time in either Windows or MacOSX and it coordinates with the other OS. Nice tip!
Glad it helped!
Thanks for the article. It was enlightening.
Slightly off topic but I have a problem with my Javascript time in Firefox being incorrect, if I go to this page for example https://browserleaks.com/javascript It reports the time wrong under System Time: at the end of that line it says GMT+0000 (UTC) whereas if I view it in IE or Edge (the only other browsers I have installed) it says GMT+1000 (AUS Eastern Standard Time) at the end of that line giving the correct time, its a pain because it makes times for forum posts etc wrong. Anyone have a solution for this ?
Good write up . This problem caused issues for me when I first started dual-booting.
Slightly offtopic but the similarities between Windows registry and system D commands are interesting.
Like Bean, I use NetTime 3.1.4.220 in Windows, it’s precise.
You’d think at some point in the preceding 35 years that Microsoft would’ve corrected the original mistake of using RTC but apparently not, having leftovers from the days of MSDOS says a lot IMO.
They can’t; there are actually programs out there (almost certainly from pre WinXP days; yes, I mean Win3.1, 95, 98, etc) that are designed to work around this issue, and fixing it would cause them to break.
That’s a drawback to being the 800lb gorilla in the market; even when they *want* to fix it, they probably *can’t*.
Heh.
Had several problems with windows updates after trying the registry hack, best to make the change in linux.
That was 6 or 8 months ago however so maybe microsoft changed something in there.
Hey! I’ve had this problem too, and I used this little program from Net Time: http://www.timesynctool.com/
In linux, the time stays fine, but in windows it was bouncing around. This small service keeps everything updated for me.
May not be as elegant as your solution, but I find it’s maintenance free, and the file/service is 771kb/465kb respectively.
Off topic.
I use the Neustar Free Recursiv DNS (https://www.neustar.biz/security/dns-services/free-recursive-dns-service) with option Threat Protection (ipv4 156.154.70.2 and 156.154.71.2 – ipv6 2610:a1:1018::3 and 2610:a1:1019::3. Your filter blocked ghacks how hacking. If possible (admin of ghacks) contact Neustar to solved problem.
It doesn’t look like Neustar offers a dnscrypt server like OpenDNS does. Therefore not an option for me.
Personally I recommend OpenDNS, their DNS servers have yet to cause any issues.
Note: Exist Neustar Free Recursive DNS without filter. The Neustar use 30 nodes and OpenDNS only 25.
It is only 1 false positive. Normal.
Thiago, you should switch to a more reliable DNS service… Though, I have a hard time letting a third party choose what they think is best or secure for me.
Neustar Free Recursive DNS is secure. Consider that others users use too. The best solution not is flee, but solve problem. It is only 1 false positive.