Question

Maybe someone has an idea. I want to ensure that the system has the right day / year within at least a couple of days before my script is run. Any ideas on how I can do that ?

Was it helpful?

Solution

See this guide http://www.pool.ntp.org/en/use.html

If you're using a recent Windows version, you can use the ntp client that is built into the system. As administrator enter

w32tm /config /syncfromflags:manual /manualpeerlist:0.pool.ntp.org,1.pool.ntp.org,2.pool.ntp.org,3.pool.ntp.org

at the command prompt. This will work on Windows 2003 and newer. If you use an older version of windows you can try

net time /setsntp:"0.pool.ntp.org 1.pool.ntp.org 2.pool.ntp.org"

The same can be achieved by, as administrator, right-clicking the clock in the taskbar, selecting 'Adjust Date/Time' and entering the server name in the 'Internet Time' tab.

Meinberg made a port of the ntp daemon for windows.

If your Windows system is part of a domain, you might not be able to independently update your computer time. For more information about setting the time on windows, see How Windows Time Service Works.

Also check out the %date% and %time% environment variables.

OTHER TIPS

I have same problem. You can use that compare the local time with on off the ntp pool.

w32tm /stripchart /samples:1 /computer:es.pool.ntp.org /dataonly

I have a script that fails if the difference is bigger than 180 sec. I can expand it if you still need it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top