[PATCH] Simplify th_bintime update in tc_windup()
Konstantin Belousov
kostikbel at gmail.com
Wed Oct 11 11:03:44 UTC 2017
On Wed, Oct 11, 2017 at 11:49:01AM +0200, Sebastian Huber wrote:
> On 11/10/17 11:31, Konstantin Belousov wrote:
>
> > On Wed, Oct 11, 2017 at 08:48:16AM +0200, Sebastian Huber wrote:
> >> The th_bintime, th_microtime and th_nanotime members of the timehand all
> >> cache the last system time (uptime + boottime). Only the format
> >> differs. Do not re-calculate the bintime and simply use the value used
> >> to calculate the microtime and nanotime.
> >>
> >> Group all the updates under the relevant comment.
> > th->th_bintime is recalculated after possible adjustments made by
> > the ntp loop to the th_boottime.
>
> The loop is:
>
> bt = th->th_offset;
> bintime_add(&bt, &th->th_boottime);
>
> <--- here the bt is our new system time
>
> i = bt.sec - tho->th_microtime.tv_sec;
> if (i > LARGE_STEP)
> i = 2;
> for (; i > 0; i--) {
> t = bt.sec;
> ntp_update_second(&th->th_adjustment, &bt.sec);
> if (bt.sec != t)
Can you fix your mail client ? The mail body is filled with the \x9a
symbols which makes the text unreadable and requiring decyphering.
>
> <-- here the bt.sec changed
>
> th->th_boottime.sec += bt.sec - t;
>
> <-- here we update the boottime seconds, so now bt == uptime + boottime
> }
>
> So, I think the patch is correct.
Thank you for the explanation. I committed this as r324528.
>
> >
> > But your patch makes me consider the two lines after the XXX comment.
> > Shouldn't we use the updated th_bintime instead of the pre-adjustment
> > bt value ?
> >
>
> All values should reflect the same time.
s/should// due to synchronity of the updates to bt and th_bootime, as
you noted above.
More information about the freebsd-hackers
mailing list