ntpd.diff 679 B

123456789101112131415161718192021222324
  1. This patch scales down small offsets quadratically. Reduces sensitivity to jitter
  2. diff --git a/networking/ntpd.c b/networking/ntpd.c
  3. index 4695c33..ac05815 100644
  4. --- a/networking/ntpd.c
  5. +++ b/networking/ntpd.c
  6. @@ -1654,6 +1654,17 @@ update_local_clock(peer_t *p)
  7. */
  8. if (G.offset_to_jitter_ratio >= TIMECONST_HACK_GATE)
  9. tmx.constant--;
  10. +
  11. +{
  12. + double d = p->lastpkt_delay;
  13. + if (d > SLEW_THRESHOLD)
  14. + d = SLEW_THRESHOLD;
  15. + d /= 2;
  16. + if ((abs_offset / d) < 1) {
  17. + offset *= (abs_offset / d);
  18. + }
  19. +}
  20. +
  21. tmx.offset = (long)(offset * 1000000); /* usec */
  22. if (SLEW_THRESHOLD < STEP_THRESHOLD) {
  23. if (tmx.offset > (long)(SLEW_THRESHOLD * 1000000)) {