instantaneously sync time via NTP after large offset on win10

0

One of my Win10 machines has a large time offset, in the order to weeks (its a VM that gets unpaused on request).

In the age of short-lived SSL certificates, it is crucial for many (web-based) operations to have correct time set. For precision reasons (and because I don't want to be bothered to "manually" remember the actual time) I'd like to use NTP.

Unfortunately, because the time offset is so large, when synching to an NTP server the time is either adjusted very slowly or discarded altogether, (making the time practically unusable until the next reboot).

So I thought about doing something like:

  • set the time manually to something approximately the wall-clock time
  • enable automatic time synchronization (NTP), to do the final adjustments

Unfortunately, the system is playing tricks on me, as this is what's actually happening:

  • I unpause the machine; it has a time of e.g. 2018-04-30 13:17
  • I login, right-click the clock, select "change time and date"
  • I switch off the automatic time synchronisation (as it was enabled in the paused machine)
  • I click on Change time/date
  • I set the date to approx the current date, e.g. 2018-06-13 10:35
  • I close the window via the Apply button, and see how the (almost) correct is displayed in the task-bar
  • I switch on the automatic time synchronisation again, to get the minutes and seconds right
  • the spinning wheel is displayed for a few seconds and then...
  • the time is restored to the old wrong value of 2018-04-30 13:17!

What is going on here?

After a couple of minutes the time will eventually synchronize to the NTP server (it's working fine).

But how can I sync to the NTP-server instantaneously? I really don't want to wait a couple of minutes to be able to use the machine, as the machine's sole purpose is to provide a clean environment to try out small things quickly.

umläute

Posted 2018-06-13T08:47:05.273

Reputation: 335

Instead of pausing/unpausing just let it run continuously or shut it down while not needed? As for your timing issue it might be related to the machines actual clock not yet being up to date and you might want to check whenever calling w32tm directly allows you to "instantaneously" get the correct time. – Seth – 2018-06-13T09:29:24.487

@Seth shutting down or continuously running are not an option (i need a clean environment instantaneously; think CI); as for using w32tm for setting the time, I have basically the same problem (but hoped to attract more answers in a GUI-only question :-): as soon as i issue a net start w32time, the time gets reset to the old/wrong value. finally I don't know what you mean with "the machines actual clock".

– umläute – 2018-06-13T09:39:55.083

Why would you start it instead of actually telling it to run a sync? And with the machines actual clock I'm talking about the machines actual clock that's saved in the BIOS. – Seth – 2018-06-13T09:43:46.457

Just doing a plain sync was refused because the time difference is too big (even after setting MaxPosPhaseCorrection and MaxNedPhaseCorrection to 0xFFFFFFFF]). – umläute – 2018-06-13T11:07:52.967

Could you post the actual error message? Doing a time travel to 1999 and running w32tm /resync took mere seconds. – Seth – 2018-06-13T11:40:31.147

No answers