First of all, please, you should never ask a question about computers without
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 terrorists. All that being said, I used the ntpq program, which is in the ntp/bin directory, 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: ntpq> peers remote refid st t when poll reach delay offset jitter ============================================================================ == FreeNAS 192.168.1.100 3 u 14 16 7 0.257 -0.353 0.310 +209.51.161.238 .CDMA. 1 u 13 16 7 16.499 1.689 0.480 -time-c.nist.gov .ACTS. 1 u 13 16 5 87.567 34.167 0.714 -time-d.nist.gov .ACTS. 1 u 13 16 5 86.541 34.231 0.596 -bonehed.lcs.mit .CDMA. 1 u 9 16 7 24.862 1.969 1.437 -timelord.w1nr.n 200.98.196.212 2 u 9 16 7 13.593 -0.543 2.816 +ntp1.conectiv.c .IRIG. 1 u 13 16 7 22.165 -0.793 0.598 -lookingglass.ed 74.104.167.114 2 u 7 16 7 16.441 -1.988 0.996 *time.falk.us .GPS. 1 u 8 16 7 24.969 -0.128 0.698 The first column is the tally code. The '*' is the server synced to, '+' are sync 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 to ntpq, where 0 stands for system variables, and rv means readvar or read variables. A typical return is: ntpq> rv 0 associd=0 status=0615 leap_none, sync_ntp, 1 event, clock_sync, version="ntpd 4.2.8p8@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=209.51.161.238, 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, expire=201612280000 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. Charles Elliott -----Original Message----- From: questions [mailto:questions-bounces+elliott.ch=comcast....@lists.ntp.org] On Behalf Of sneha b Sent: Tuesday, September 20, 2016 6:49 AM To: questions@lists.ntp.org Subject: [ntp:questions] Query NTP status on windows7 Hi, 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. Thanks _______________________________________________ questions mailing list <mailto:questions@lists.ntp.org> questions@lists.ntp.org <http://lists.ntp.org/listinfo/questions> http://lists.ntp.org/listinfo/questions _______________________________________________ questions mailing list questions@lists.ntp.org http://lists.ntp.org/listinfo/questions