[ntp:questions] ntp-4.2.6p5 on Win 7 x64

David Woolley david at ex.djwhome.demon.invalid
Fri Jul 25 09:43:50 UTC 2014


On 24/07/14 23:43, David Woolley wrote:
> On 24/07/14 23:24, William Unruh wrote:
>
>>
>> ??
>> The correction is to change the frequency so that a fraction of the
>> current offset will be eliminated by the next correction. Not sure what
>> you mean by your comments on reducing increments.
>>
>>>
>
> As far as I remember, ntpd is a PI controller.  The proportional bit is
> done by applying a decaying fraction of the offset (more or less
> directly if using Linux user space mode, a bit more complex if you can
> only control frequency, as on Windows).
>
> It is just possible it stopped doing this between v3 and v4.

Here is edited code from 4.2.7p333.  I have edited it to remove code for 
the kernel discipline (where the actual work is in the kernel) and some 
clamping of values to range.  Note the comment about Windows says that 
adjustments are made every second.


		offset_adj = clock_offset / (CLOCK_PLL * ULOGTOD(sys_poll));
		freq_adj = drift_comp;
	clock_offset -= offset_adj;
	/*
	 * Windows port adj_systime() must be called each second,
	 * even if the argument is zero, to ease emulation of
	 * adjtime() using Windows' slew API which controls the rate
	 * but does not automatically stop slewing when an offset
	 * has decayed to zero.
	 */
	adj_systime(offset_adj + freq_adj);



More information about the questions mailing list