[PATCH] Simplify th_bintime update in tc_windup()
Konstantin Belousov
kostikbel at gmail.com
Wed Oct 11 09:31:21 UTC 2017
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.
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 ?
>
> Is the
>
> "XXX shouldn't do this here. Should force non-`get' versions."
>
> part of the comment still valid?
> ---
> sys/kern/kern_tc.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c
> index 088fcb41cfa..e7cfc51aff7 100644
> --- a/sys/kern/kern_tc.c
> +++ b/sys/kern/kern_tc.c
> @@ -1413,10 +1413,9 @@ tc_windup(struct bintime *new_boottimebin)
> if (bt.sec != t)
> th->th_boottime.sec += bt.sec - t;
> }
> - th->th_bintime = th->th_offset;
> - bintime_add(&th->th_bintime, &th->th_boottime);
> /* Update the UTC timestamps used by the get*() functions. */
> /* XXX shouldn't do this here. Should force non-`get' versions. */
> + th->th_bintime = bt;
> bintime2timeval(&bt, &th->th_microtime);
> bintime2timespec(&bt, &th->th_nanotime);
>
> --
> 2.12.3
More information about the freebsd-hackers
mailing list