LHPControl icon indicating copy to clipboard operation
LHPControl copied to clipboard

Auto time synchronization

Open ltoni90 opened this issue 5 years ago • 1 comments

Sometimes the system clock does not synchronize correctly which can cause the following Binance API error: {"code":-1021,"msg":"Timestamp for this request was 1000ms ahead of the server's time."}

I solved this issue with a small PowerShell script which will sync the time hourly:

$timeService = Get-Service -Name W32Time

if($timeService.StartType -eq "Disabled") {
    Set-Service W32Time -StartupType Manual
}
if($timeService.Status -eq "Running") {
    net stop W32Time
} 

net start W32Time
w32tm /config /manualpeerlist:"0.ch.pool.ntp.org" /syncfromflags:manual /reliable:yes /update

while($true) {
    w32tm /resync
    Start-Sleep -Seconds 3600
}

Is it possible to integrate this fix in the next release of LHPControl?

Thanks!

ltoni90 avatar Dec 29 '20 10:12 ltoni90

Thank you! I will look into adding this function.

daisy613 avatar Dec 30 '20 03:12 daisy613