From 029bd187bdad5bfd7771ed356e633e8ec8044d2e Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 2 Jul 2018 16:17:07 +0200 Subject: ntpd: increase minimum G.FREQHOLD_cnt from 8 to 10 With ~0.9 initiall offsets, using 8 results in a bit too eager frequency correction. Signed-off-by: Denys Vlasenko --- networking/ntpd.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'networking') diff --git a/networking/ntpd.c b/networking/ntpd.c index a1b8ac5b0..7b800369e 100644 --- a/networking/ntpd.c +++ b/networking/ntpd.c @@ -149,6 +149,7 @@ */ #define INITIAL_SAMPLES 4 /* how many samples do we want for init */ +#define MIN_FREQHOLD 10 /* adjust offset, but not freq in this many first adjustments */ #define BAD_DELAY_GROWTH 4 /* drop packet if its delay grew by more than this */ #define RETRY_INTERVAL 32 /* on send/recv error, retry in N secs (need to be power of 2) */ @@ -1753,7 +1754,7 @@ update_local_clock(peer_t *p) //15:19:39.114 update from: offset:+0.327022 delay:0.158384 jitter:0.108538 clock drift:-1.393ppm tc:4 //15:20:12.715 update from: offset:+0.275596 delay:0.158297 jitter:0.097292 clock drift:-1.393ppm tc:4 //15:20:45.111 update from: offset:+0.225715 delay:0.158271 jitter:0.087841 clock drift:-1.393ppm tc:4 -// If allwed to continue, it would start increasing tmx.freq now. +// If allowed to continue, it would start increasing tmx.freq now. // Instead, it was ^Ced, and started anew: //15:21:15.043 no valid datapoints, no peer selected //15:21:17.408 update from: offset:+0.175910 delay:0.158314 jitter:0.076683 clock drift:-1.393ppm tc:4 @@ -1776,9 +1777,9 @@ update_local_clock(peer_t *p) //15:31:53.473 update from: offset:+0.000007 delay:0.158142 jitter:0.010922 clock drift:+9.343ppm tc:6 //15:32:58.902 update from: offset:-0.000728 delay:0.158222 jitter:0.009454 clock drift:+9.298ppm tc:6 /* - * This expression would choose 15 in the above example. + * This expression would choose MIN_FREQHOLD + 7 in the above example. */ - G.FREQHOLD_cnt = 8 + ((unsigned)(abs(tmx.offset)) >> 16); + G.FREQHOLD_cnt = MIN_FREQHOLD + ((unsigned)(abs(tmx.offset)) >> 16); } G.FREQHOLD_cnt--; tmx.status |= STA_FREQHOLD; -- cgit v1.2.3