Updated: November 1, 2017
I've noticed an interesting phenomenon. On my Lenovo G50 machine, which multi-boots Windows 10 with a host of Linux distributions, every time I launch the Microsoft operating system, the time is off by one hour. The timezone is set correctly, but the little digital widget in the right bottom corner fakes it by 60 minutes.
I started exploring, reading and checking, and realized that I should write a little tutorial on this. Now, the problem may also affect people who use Windows 10 standalone, without any reference to other operating systems. Either way, we will focus on the solution on the Windows side of things, and how we can work around the issue.
There are many reasons why the Windows 10 time may be wrong. People sometimes assume this is a general problem, and that their particular case is universal. Alas, it is not so. Firewall issues, Windows time service problems, time sync, there are several scenarios, etc. We cannot know them all - but we can resolve them all.
Specifically in dual-boot scenarios, we need to understand a few concepts. This is explained in detail in the Ubuntu Help section on this particular topic. Notably, every modern computer stores the time in a so-called hardware clock, which is part of the chipset and powered by a small battery. This allows computers to retain correct time and date when you turn them on, even if they had been disconnected from power, albeit for a relatively long if limited time (several months). Operating systems may update this value, usually when they are given the command to shut down. Alternatively, they may also use the hardware clock.
Most Linux distributions set the hardware clock to UTC. Windows normally uses local time, which usually corresponds to whatever 'local' timezone you have selected. If and when timezones change (daylight saving time thingie), there is an offset of 1 hour (back or forward) in the local time, but not in the UTC, which remains constant and is not affected by DST or timezone changes. Therefore, when you reboot from one operating system into another, i.e. Linux to Windows, until Windows has synced its clock, the time may be off by one hour. This is the mystery of our problem.
The solution to this can be: Change what type of time value is stored in the hardware clock by Linux. Most distributions use UTC, and you can change that. We won't do that, because we want to make Windows behave.
Therefore, the alternative is to make Windows not use local time. There are two options to achieve this: 1) We will need to make a registry change and stop the Windows time service, but this means Windows will not be updating its clock 2) The other venue of action is to make Windows sync its clock more frequently than its default, which used to be one week in Windows 7/8 and has been reduced to one day in Windows 10. I will show you both these, and you decide which one you prefer. I believe the second option is more elegant.
You will need to create a registry change. Navigate to:
And then change the key RealTimeIsUniversal with the value of 1:
Reboot, see if this works. If not, you may need to disable the time service:
This tutorial explains several methods of how to do it, and how not to do it - much like Monty Python's sketch How Not To Be Seen. Indeed, this aligns well with what I had in mind. Create a scheduled task that will run on logon and sync the time. Problem solved. Let's work out the details for this.
Open Task Scheduler > Create Task. You can place this task anywhere. The setup for a scheduled task is somewhat convoluted, but it can be achieved. On the General tab, name and describe the task. Then select the user. This is an interesting one, because in my case I am running as a limited account, so I had to choose the Administrator account to achieve this, but that also mean running regardless of whether the user is logged on or not - also without saving the password, which is fine, because we only need access to local resources. Configure for Windows 10.
Then, we need a new trigger - basically when. At log on.
We now need to setup two actions - one is to run the Windows time service, in case it isn't running already. The program to run this is %windir%\system32\sc.exe, and the argument start w32time task_started. Then we also need the second action, which is to resync time. The program is %windir%\system32\w32tm.exe, and the argument /resync.
Lastly, the condition for the execution of this scheduled task is to run whether on AC power or battery, and to use any network connection. Click OK, and on next logon, things should be dandy.
You also also always manually sync time. You can open the Date and Time applet through System Settings, Control Panel or by right-clicking on the clock in the system tray > Change Time and Date. Select the Internet Time tab. Click Update now.
This is it. Regardless of your actual operational setup - single boot, dual-boot, multi-boot, we are not concerned with other systems, only Windows 10. We want to make sure that it has the correct time, and we have two options to achieve this. Force the system to use UTC or make a scheduled task that runs on logon and resyncs the clock. Both are fairly benign, but the latter is a less intrusive method in general.
Hopefully, you will find this tutorial valuable, and it may save you some annoying headache with a relatively trivial but not easily ignored issue. Most people will rarely encounter this, but if they do, the solutions are all here. And we're done.