[ntp:questions] Query NTP status on windows7
elliott.ch at comcast.net
Tue Sep 20 16:43:30 UTC 2016
First of all, please, you should never ask a question about computers
stating what your platform is, O/S and version, CPU, and memory size. When
asking a question about NTPD, you should state what version you are using.
Second, people can help more if you tell them what you are trying to do,
what your goal is.
Third, it would help if you would identify yourself, name and organization,
or at least organization type. I, for one, am opposed to giving advice to
All that being said, I used the ntpq program, which is in the ntp/bin
for something similar to what you want. The documentation for ntpq is in
ntp/doc/HTML/ntpq.html. I was working in Java, so I used the ProcessBuilder
class to start ntpq and pipe its output back to my program. I issued the
host command to ntpq to set the IP address of the queried computer. Then
I repeatedly issued the peers command and parsed the output, which is:
remote refid st t when poll reach delay offset
FreeNAS 192.168.1.100 3 u 14 16 7 0.257 -0.353
+184.108.40.206 .CDMA. 1 u 13 16 7 16.499 1.689
-time-c.nist.gov .ACTS. 1 u 13 16 5 87.567 34.167
-time-d.nist.gov .ACTS. 1 u 13 16 5 86.541 34.231
-bonehed.lcs.mit .CDMA. 1 u 9 16 7 24.862 1.969
-timelord.w1nr.n 220.127.116.11 2 u 9 16 7 13.593 -0.543
+ntp1.conectiv.c .IRIG. 1 u 13 16 7 22.165 -0.793
-lookingglass.ed 18.104.22.168 2 u 7 16 7 16.441 -1.988
*time.falk.us .GPS. 1 u 8 16 7 24.969 -0.128
The first column is the tally code. The '*' is the server synced to, '+'
candidates, and '-' means discarded by the cluster algorithm. Space ' '
means designated no select, in my case.
An easier way, according to the documentation, is to issue the rv 0 command
where 0 stands for system variables, and rv means readvar or read variables.
typical return is:
ntpq> rv 0
associd=0 status=0615 leap_none, sync_ntp, 1 event, clock_sync,
version="ntpd 4.2.8p8 at 1.3265-o Jun 18 15:51:19.34 (UTC+01:00) 2016 (1)",
processor="x86-SSE2", system="Windows", leap=00, stratum=2,
precision=-22, rootdelay=12.119, rootdisp=2.987, refid=22.214.171.124,
reftime=db8be1e9.5be1a5a3 Tue, Sep 20 2016 12:27:21.358,
clock=db8be1eb.c0fab301 Tue, Sep 20 2016 12:27:23.753, peer=37206, tc=5,
mintc=3, offset=0.132622, frequency=-15.726, sys_jitter=0.382788,
clk_jitter=0.754, clk_wander=0.021, tai=36, leapsec=201507010000,
According to the documentation "clock_sync" means the system is synchronized
and "refid" is the peer synced to, but I have never personally used these
for this purpose. The status word is described in decode.html and
might possibly be useful to you.
[mailto:questions-bounces+elliott.ch=comcast.net at lists.ntp.org] On Behalf Of
Sent: Tuesday, September 20, 2016 6:49 AM
To: questions at lists.ntp.org
Subject: [ntp:questions] Query NTP status on windows7
Is there a way to find out whether the sync was successful or not.
In vxworks we have ipsntp_query_time, is there something similar to this so
that I can use it programmatically and return success/failure.
questions mailing list
<mailto:questions at lists.ntp.org> questions at lists.ntp.org
More information about the questions