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

1

3

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.

Glaydsglaze answered 28/1, 2016 at 17:48 Comment(0)
R
5

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

Reddick answered 29/2, 2016 at 18:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.