Ok so happily I got the vendor to see sense and fix their interface (enough). Since I hate to leave things unanswered, there is a simple solution, if you are unfortunate enough to need to do this:
- set the w32time to manual (instead of automatic)
- create a scheduled task to sync the clock, and skew the time on the very next line
If you are on a domain you are probably using a Domain Controller (automatically) as the time source. So you need to ask the domain for the time server, to be able to put it in the call to w32time.
For the remainder of this text, example.com is the domain, and time.example.com is the time server.
To get the time server for a typical domain (example.com):
nltest /dsgetdc:example.com
Grab the "DC: ..." value. It will be your time server.
To set your time sync to manual
run this command:
w32tm /config /syncfromflags:manual /reliable:YES /update
Then restart 'Windows Time' service.
to get time skew
w32tm /stripchart /computer:time.exaample.com /samples:3 /dataonly
Take the data in the second column, and average the three numbers. That is how far ahead or behind server is compared to the time source.
to add time to the current clock using powershell
Set-Date -Date (Get-Date).AddSeconds(1.03)
Note: this will add a few milliseconds more than the "1.03" in the example. You could call it several times to measure how many milliseconds are added, and build this into how you calculate the values for the function call. Depending on how accurate you need to be, you may want to check time skew again after setting this.
To set your clock sync back to automatic
run this command:
w32tm /config /syncfromflags:domhier /update
Then restart 'Windows Time' service.
So Putting it all Together
- Set the Windows Time (W32tm) sync to manual
- Create a scheduled task to regularly call a script to manually sync the time.
The Script Steps
This assumes you are need to have the local clock X an amount of time ahead(/behind) another server's clock. If you just need it skewed from the time server, you can simplify this script.
- If needed, determine the time source
- sync the clock
- measure time skew of the local clock
- Check if the server is already ahead/behind enough your other server's clock:
- use remote powershell to execute the command to measure time skew
- compare the time skew of the local and remote server so see how far ahead the server currently is.
- if determined that the server time needs adjusting:
- sync the local clock
- run the command to check the time skew
- compare the actual skew to the required skew
- if required, run a command to add X.yyyy amount of seconds to the local clock.