Saturday, December 24, 2016

How can I query an NTP server under Windows?


I am not interested in synchronizing my local clock with the remote server. I only want to query it and print the result.


I would have assumed that there is a port of ntpq for Windows, but was unable to find any.


All other NTP clients I could find, they always want to install themselves as a service or make it otherwise clear that they want to synchronize my local time.


Answer



C:\> w32tm /stripchart /computer:foo
Tracking foo [1.2.3.4].
The current time is 19/07/2012 17:39:48 (local time).
17:39:48 d:-00.0000840s o:-25.3004160s [@ | ]
17:39:50 d:-00.0000680s o:-25.3070080s [@ | ]
17:39:52 d:-00.0000690s o:-25.2987405s [@ | ]
17:39:54 d:-00.0000680s o:-25.3071530s [@ | ]
17:39:56 d:-00.0000690s o:-25.2993985s [@ | ]
17:39:58 d:-00.0000680s o:-25.3070270s [@ | ]

Wireshark shows NTP packets being generated by this. Some versions of w32tm have a /query option


C:\>w32tm /stripchart /computer:us.pool.ntp.org /dataonly /samples:5
Tracking us.pool.ntp.org [208.87.221.228:123].
Collecting 5 samples.
The current time is 19/07/2012 18:36:32.
18:36:32, +03.3575094s
18:36:34, +03.3573679s
18:36:37, +03.3572986s
18:36:39, +03.3570290s
18:36:41, +03.3565357s

No comments:

Post a Comment

hard drive - Leaving bad sectors in unformatted partition?

Laptop was acting really weird, and copy and seek times were really slow, so I decided to scan the hard drive surface. I have a couple hundr...