From: Miroslav Lichvar Date: Mon, 5 Oct 2020 08:16:53 +0000 (+0200) Subject: sched: include unexpected jumps in monotonic time X-Git-Tag: 4.0~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f15f6a86b05c67d2317694447edd66b064b9d17a;p=thirdparty%2Fchrony.git sched: include unexpected jumps in monotonic time Update the monotonic time before the timestamps are corrected for unexpected jumps, e.g. due to the computer being suspended and resumed, and switch to the raw timestamps. This should allow the NTS refresh interval to better follow real time, but it will not be corrected for a frequency offset if the clock is not synchronized (e.g. with -x). --- diff --git a/sched.c b/sched.c index f1fbaf55..b83a8931 100644 --- a/sched.c +++ b/sched.c @@ -799,14 +799,14 @@ SCH_MainLoop(void) LCL_ReadRawTime(&now); LCL_CookTime(&now, &cooked, &err); + update_monotonic_time(&now, &last_select_ts_raw); + /* Check if the time didn't jump unexpectedly */ if (!check_current_time(&saved_now, &now, status == 0, &saved_tv, ptv)) { /* Cook the time again after handling the step */ LCL_CookTime(&now, &cooked, &err); } - update_monotonic_time(&cooked, &last_select_ts); - last_select_ts_raw = now; last_select_ts = cooked; last_select_ts_err = err;