+* [Bug 2473] NTPD exits after clock is stepped backwards externally
(4.2.7p385) 2013/08/19 Released by Harlan Stenn <stenn@ntp.org>
* CID 975596: Copy/paste error: vallen should be siglen.
* CID 1009579: Check return status of X509_add_ext().
l_fp *now /* system time */
)
{
+ static struct timespec ts_last; /* last sampled os time */
static struct timespec ts_prev; /* prior os time */
static l_fp lfp_prev; /* prior result */
static double dfuzz_prev; /* prior fuzz */
DEBUG_REQUIRE(systime_init_done);
ENTER_GET_SYSTIME_CRITSEC();
+ /* First check if here was a Lamport violation, that is, two
+ * successive calls to 'get_ostime()' resulted in negative
+ * time difference. Use a few milliseconds of permissible
+ * tolerance -- being too sharp can hurt here.
+ */
+ if (cmp_tspec(ts, sub_tspec_ns(ts_last, 50000000)) < 0)
+ lamport_violated = 1;
+ ts_last = ts;
+
/*
* After default_get_precision() has set a nonzero sys_fuzz,
* ensure every reading of the OS clock advances by at least