Is there a way to ensure ntp synced clock never moves backwards?

老子叫甜甜 提交于 2019-12-12 05:27:55

问题


Let say I have code that uses the clock to generate ids. Or I have code that calculates time elapsed since an event happened. Or any other logic that expects system time to only move forwards, never backwards. If time does move backwards, and the program notices it, lets say it crashes or hangs.

I'd like to use an NTP service with such programs. Is there a way that NTP can be configured so that it is guaranteed never to adjusts time backwards? Slowing down the system clock would be fine.

So a second could be longer or shorter, but system time should never move backwards.


回答1:


With standard ntpd you may have a look at tinker configuration command. It allows specifying "never step the clock" by setting "stepback 0" and (if you also do not want the clock being stepped forward) "stepfwd 0" (Or even plain "step 0").

Otherwise it will step (back) if local clock is behind >= 128ms and terminate if local clock is off >= 1000s



来源:https://stackoverflow.com/questions/35068445/is-there-a-way-to-ensure-ntp-synced-clock-never-moves-backwards

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!