[ntp:questions] Extracting ntpq like information programmatically
cswiger at mac.com
Fri Mar 29 20:12:06 UTC 2013
On Mar 29, 2013, at 12:27 PM, Claudio Carbone wrote:
> On 29/03/13 19:26, Brian Utterback wrote:
>> As unruh said, if there was a way to improve the accuracy of the measurement over the network like that, NTP would already be doing it.
> If so why doesn't the offset oscillate?
It usually does, although the most common type of cyclical offset variations occur with a period of 24 hours, resulting from day/night temperature changes affecting the quartz crystal.
> If NTP were a real compensation system, it should oscillate around the setpoint.
A well-designed compensation system doesn't over-force the corrective adjustment being made and thus avoids overshooting and then "ringing" back and forth across the setpoint.
> Instead I noticed a nearly static offset, at least during the 15 minutes observation time.
Sure. You're not gathering data for nearly a long enough timeframe.
Once ntpd stabilizes, it is looking at 8 previous samples taken 1024 seconds apart (by default)-- ie, a 2+ hour baseline-- and then using adjtime() or similar to gradually slew the clock towards what it believes to be correct time at a maximum rate of 1:2000 (ie, 0.5 milliseconds per second). Most systems stabilize such that the adjustments they need to make are better represented on the order of tens of parts-per-million.
More information about the questions