Hacker News new | ask | show | jobs
by robocat 859 days ago
When synchronising Windows with an external source, you can slowly correct the time using: https://learn.microsoft.com/en-us/windows/win32/api/sysinfoa...

Using that API avoids sudden jumps in time. The cost is that if a correction is required then the system time will be incorrect until the difference settles to zero. And you ideally need some PID control so that the system time settles quickly to match the "correct" external time.

For example you can spread a 1 second adjustment over an hour. Sometimes being up to one second out is less problem than a sudden jump of one second.

It is useful to have time monotonically increasing if you have software that depends on time differences (e.g. timestamps stored in logging systems).

Not sure if Microsoft gimped the API after XP - this note seems bad "Currently, Windows Vista and Windows 7 machines will lose any time adjustments set less than 16." Make it difficult to use API to steadily keep time synchronised closely.

1 comments

Isn't this what Google dubbed as smearing in their Spanner paper?
Kinda. Clock slewing is the term used in NTP-land and is basically about making this kind of adjustment for small time differences (generally you want to run a control loop that adjusts the rate of the internal clock so that the time difference goes to zero, as opposed to simply changing the time, as one will result in a smooth time reading while the other will cause periodic jumps). Smearing is basically pretending that the leap second doesn't exist and using clock slewing to paper over the difference.
AFAIK they were using Linux, and they were still keeping all the servers synchronised (smearing at the same rate).