[ntp:questions] Deciding whether NTP is synchronised?

Terje Mathisen "terje.mathisen at tmsw.no" at ntp.org
Fri Apr 24 19:15:21 UTC 2009

Juliusz Chroboczek wrote:
> Hi,
> How can a userspace application decide whether the current time is
> trustworthy?
> For a project of mine, I need to reliably find out whether the system
> time is within 5 minutes of UTC.  The network will include both
> unmanaged client nodes and routers that don't have a battery backed
> clock, so incorrect time is rather common.
> Is that correct?  Or is there a better way?

I'd run sntp or ntpdate against a known good source, and note both the 
measured offset and the total trip time:

The maximum offset would be the trip time plus the maximum offset of the 

Anyway, if you're only looking at 5 min precision, simply running ntpd 
locally is almost overkill: As long as 'ntpq -c rv -p' gives a star for 
one of the servers, you cannot be more than 128 ms off.


- <Terje.Mathisen at tmsw.no>
"almost all programming can be viewed as an exercise in caching"

More information about the questions mailing list