[PATCH 0/5] Fix ntpd to not poll frequently

Miroslav Lichvar mlichvar at redhat.com
Wed Oct 1 12:18:01 UTC 2014


On Wed, Oct 01, 2014 at 12:57:17AM +0200, Denys Vlasenko wrote:
> I am looking at patch #5 again. Can you talk me through it?
> 
> @@ -1470,6 +1466,14 @@ update_local_clock(peer_t *p)
> 
>         } else { /* abs_offset <= STEP_THRESHOLD */
> 
> +               /* This is calculated before the jitter is updated to make the
> +                * poll adjust code more sensitive to large offsets.
> +                */
> +               if (G.discipline_jitter > 0.0)
> +                       G.offset_to_jitter_ratio = abs_offset /
> G.discipline_jitter;
> +               else
> +                       G.offset_to_jitter_ratio = 1.0;
> +
>                 /* Compute the clock jitter as the RMS of exponentially
>                  * weighted offset differences. Used by the poll adjust code.
>                  */
> @@ -1554,7 +1558,6 @@ update_local_clock(peer_t *p)
> 
>         if (G.discipline_jitter < G_precision_sec)
>                 G.discipline_jitter = G_precision_sec;
> -       G.offset_to_jitter_ratio = abs_offset / G.discipline_jitter;
> 
>         G.reftime = G.cur_time;
>         G.ntp_status = p->lastpkt_status;
> 
> What does this part achieve? Why is it better this way?

The offset/jitter ratio is calculated before jitter is updated with
the new (possibly large) offset to make the test which adjusts the
poll more sensitive. Without this change it didn't work well in my
testing, it was pretty much always going up.

-- 
Miroslav Lichvar


More information about the busybox mailing list