如果时钟关闭,NTPD可以以慢速增量调整时钟.这背后的想法是缓慢的步骤不会导致软件定时器问题,日志文件和数据等奇怪的差距.
The maximum slew rate possible is limited to 500 parts-per-million (PPM) by the Unix kernel. As a result,the clock can take 2000s for each second the clock is outside the acceptable range.
根据手册页,如果您的时钟超过1000秒,ntpd将无法工作. (虽然您可以使用-g开关调整,慢慢补偿1000秒的偏移量已经超过3周.)
其次,当您启动ntpd时,您观察到的时间跳跃是ntpd启动时偏移量大于128 ms时默认ntpd行为的步骤而不是转换时钟的结果.当ntpd在启动时启动但在运行的系统上不是您想要的时候这是有意义的.
您可以通过将-x开关添加到ntpd的启动选项来防止这种情况.从手册:
-x
Normally,the time is slewed if the offset is less than the step threshold,which is 128 ms by default,and stepped if above the threshold. This option sets the threshold to 600 s,which is well
within the accuracy window to set the clock manually. Note: Since the slew rate of typical Unix kernels is limited to 0.5 ms/s,each second of adjustment requires an amortization interval of 2000 s Thus,an adjustment as much as 600 s will take almost 14 days to complete. This option can be used with the -g and -q options
在RHEL系统中,可以在启动ntpd服务之前调整/ etc / sysconfig / ntpd配置文件:
# /etc/sysconfig/ntpd
# Drop root to id 'ntp:ntp' by default.
OPTIONS="-u ntp:ntp -p /var/run/ntpd.pid -g -x"