summaryrefslogtreecommitdiff
path: root/networking
diff options
context:
space:
mode:
authorDenys Vlasenko2019-10-30 12:13:46 +0100
committerDenys Vlasenko2019-10-30 12:18:07 +0100
commitea096d6c1389c93bdb6c6c45a04aff9062c7d8cf (patch)
tree509ec77841766251b090e145d7435c4688cf0762 /networking
parent6b4960155e94076bf25518e4e268a7a5f849308e (diff)
downloadbusybox-ea096d6c1389c93bdb6c6c45a04aff9062c7d8cf.zip
busybox-ea096d6c1389c93bdb6c6c45a04aff9062c7d8cf.tar.gz
ntpd: decrease MIN_FREQHOLD by 2, increase "penalty" for largish offset x2
> 2018-07-25: > ntpd: increase MIN_FREQHOLD by 3 > This means we'll start correcting frequency ~5 minutes after start, > not ~3.5 ones. > With previous settings I still often see largish ~0.7s initial offsets > only about 1/2 corrected before frequency correction kicks in, > resulting in ~200ppm "correction" which is then slowly undone. Review of real-world results of the above shows that with small initial offsets, freq correction can be allowed to kick in sooner, whereas with large (~0.8s) offsets, we still start freq correction a bit too soon. Let's rebalance this a bit. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'networking')
-rw-r--r--networking/ntpd.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/networking/ntpd.c b/networking/ntpd.c
index e11160a..0f12409 100644
--- a/networking/ntpd.c
+++ b/networking/ntpd.c
@@ -164,7 +164,7 @@
*/
#define INITIAL_SAMPLES 4 /* how many samples do we want for init */
-#define MIN_FREQHOLD 12 /* adjust offset, but not freq in this many first adjustments */
+#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 factor */
#define RETRY_INTERVAL 32 /* on send/recv error, retry in N secs (need to be power of 2) */
@@ -1876,11 +1876,11 @@ update_local_clock(peer_t *p)
//15:31:53.473 update from:<IP> offset:+0.000007 delay:0.158142 jitter:0.010922 clock drift:+9.343ppm tc:6
//15:32:58.902 update from:<IP> offset:-0.000728 delay:0.158222 jitter:0.009454 clock drift:+9.298ppm tc:6
/*
- * This expression would choose MIN_FREQHOLD + 8 in the above example
- * (off_065 is +1 for each 0.065536 seconds of offset).
+ * This expression would choose MIN_FREQHOLD + 14 in the above example
+ * (off_032 is +1 for each 0.032768 seconds of offset).
*/
- unsigned off_065 = abs((int)(tmx.offset >> 16));
- G.FREQHOLD_cnt = 1 + MIN_FREQHOLD + off_065;
+ unsigned off_032 = abs((int)(tmx.offset >> 15));
+ G.FREQHOLD_cnt = 1 + MIN_FREQHOLD + off_032;
}
G.FREQHOLD_cnt--;
tmx.status |= STA_FREQHOLD;