[ntp:questions] ntp discipline of local time?
unruh-spam at physics.ubc.ca
Wed Mar 26 00:28:23 UTC 2008
David Woolley <david at ex.djwhome.demon.co.uk.invalid> writes:
>> David Woolley <david at ex.djwhome.demon.co.uk.invalid> writes:
>>> If you are using the kernel time discipline, which you should be using
>>> for high accuracy, nptd doesn't discipline the clock; it is the kernel
>>> code that does that, based on measurements provided by ntpd.
>> I do not think that this is right, unless you are referring to a PPS
>> sounce. ntp sets the frequency of the kerhel clock (Is that change in
>> frequency what you mean by kernel time discipline) by a very simple second
>> order PDE feedback, and the offset by and exponential first order feedback
>> scheme. At least that is what it looks like to me trying to read
>2.4 kernel (2.4.33): /usr/src/linux/kernel/timer.c
> 417 /*
> 418 * Compute the phase adjustment for the next second. In
> 419 * PLL mode, the offset is reduced by a fixed factor
> 420 * times the time constant. In FLL mode the offset is
> 421 * used directly. In either mode, the maximum phase
> 422 * adjustment for each second is clamped so as to spread
> 423 * the adjustment over not more than the number of
> 424 * seconds between updates.
> 425 */
The program interacts with the kernel through ntp_adjtime ( adjtimex on
linux) I believe, so lets keep the discussion at that level.
From what I see in ntp_loopfilter.c in
>loopfilter.c feeds the kernel with offset when it has a time update and
>it is in PLL mode. Note that a simple exponential decay is an IIR filter:
NO, it also feeds it a frequency offset.
I am not objecting to a simple exponential decay being an IIR filter. It is
a very specific IIR filter.
> From ntp v4.2p4: ntpd/ntp_loopfilter.c
> 172 #define MOD_BITS (MOD_OFFSET | MOD_MAXERROR | MOD_ESTERROR | \
> 173 MOD_STATUS | MOD_TIMECONST)
>gives the default set of ntpadjtime mode options.
And then line 595-597
ntv.modes |= MOD_FREQUENCY;
ntv.freq = (int32)((clock_frequency +
drift_comp) * 65536e6);
And then the whole of
* adj_host_clock - Called once every second to update the local clock.
* LOCKCLOCK: The only thing this routine does is increment the
* sys_rootdispersion variable.
whose key line is
adjustment = clock_offset / (CLOCK_PLL * min(ULOGTOD(sys_poll),
clock_offset -= adjustment;
adj_systime(adjustment + drift_comp);
Now it is not clear to me that this is actually run once a second, or if
this is only run once a second under certain conditions, or what.
This certainly produces an exponential decay.
More information about the questions