[ntp:questions] C api to ntpd

David Woolley david at ex.djwhome.demon.invalid
Fri Dec 6 22:53:02 UTC 2013

On 06/12/13 12:13, Patrik Arlos wrote:
[ Very long lines! ]

> I have a C program that needs to evaluate the system (where it runs)
clock synchronization status on a regular interval(every ~60s). On the
same system there is a ntpd running, that synchronized to other ntp servers.

A system goes from being effectively synchronized to effectively 
unsynchronised over an extended amount of time and the boundary is 
fuzzy.  60s seems far to rapid.

> * Is the server synchronized to any server, i.e. the presence of '*' for any of the servers.
> If there is a server that is '*'

The server is synchronised if there is a *, but it is not synchronised 
to just that server.

> * What is the delay associated with that server?

Root distance is more likely to be useful, but is a very pessimistic 
estimator of the likely error.

> * What is the offset associated with that server?

The offset is probably not very useful.

1) it is an instantaneous measurement, which should normally vary 
randomly about zero and should consist mainly of measurement noise.

2) the clock is disciplined by a combination of the offsets from * and + 
servers, not just the single one from the * server.

> I've looked around to find some API/library that provides this, but obviously I have not found it.

Most people use ntpq and parse the output.  ntpd itself uses a limit on 
root dispersion.

More information about the questions mailing list