:: Set system clock from the network timeserver provided as parameter
:: and record the resulting offset in %USERPROFILE\offset.txt
:: Requires: TCC (JP Software), SYSUTILS plugin (Vince Fatica)
:: (To run as scheduled task TCC must be the default handler
:: for .BTM files. see tccbatch.btm)
:: Must be run as admin (win7 - elevated) to set the system clock.
. . .
. . .
:: Do an autosync and output the offset
timesync /a %1
set EXITCODE=%_?
iff %EXITCODE == 0 then
set OFFSET=%@execstr[4, timesync /n %1]
if NOT DEFINED OFFSET set OFFSET=Timesync query failed!
else
set OFFSET=%@errtext[%EXITCODE]
endiff
echo %DATETIME %OFFSET ^<%1^> >> "%LOGFILE"