ntp 问题:调整时间与跳跃时间

ntp questions: slewing versus jumping the time

ntp 不想跳跃你的时钟,因为不连续的时间跳跃是不好的。它想逐渐调整你的时钟——非常缓慢。它非常保守:默认情况下,它不会让您的时钟偏移超过百万分之 xx (ppm)。

但由于 ntp 非常保守,如果它发现您的时钟偏差太大,以至于逐渐调整它会花费很长时间,它会回退并跳转您的时钟(即使那很糟糕)。默认情况下,如果逐渐调整时钟需要超过 yy 小时,它会执行此操作。

如果需要,您可以告诉 ntp 更快地调整您的时钟(即逐渐减少),最大为 zz ppm。

我的问题是,xx、yy 和 zz 是什么?我知道存在这些阈值,我很确定它们已记录在案,我很确定它们是可配置的,但我永远记不起这些值,也永远找不到它们。

如果您知道它们是什么,理想情况下我想知道 (a) 默认值是什么以及 (b) 它们的记录位置和 (c) 如何配置它们以及 (d) 在哪里实际的代码是做出回转或跳跃决定的。谢谢。

xx: 128ms

The ntpd algorithms discard sample offsets exceeding 128 ms, unless the interval during which no sample offset is less than 128 ms exceeds 900s.

我不知道有什么方法可以改变 xx。

yy: 600s

In practice, the need for a step has been extremely rare and almost always the result of a hardware failure or operator error. The step threshold and stepout threshold can be changed using the step and stepout options of the tinker command, respectively. If the step threshold is set to zero, the step function is entirely disabled and the clock is always slewed. The daemon sets the step threshold to 600 s using the -x option on the command line.

zz : 500ppm

The maximum slew rate possible is limited to 500 parts-per-million (PPM) as a consequence of the correctness principles on which the NTP protocol and algorithm design are based. As a result, the local clock can take a long time to converge to an acceptable offset, about 2,000 s for each second the clock is outside the acceptable range.

我不相信有办法改变 zz。

至于显示如何对 slew/step 做出决定的实际代码,您可能无法在网上找到它。只有算法。 Here and here 是关于该算法的重要链接。