aboutsummaryrefslogtreecommitdiff
path: root/sys/kern/kern_tc.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/kern_tc.c')
-rw-r--r--sys/kern/kern_tc.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c
index 3e8d47067942..2487b6b5a9db 100644
--- a/sys/kern/kern_tc.c
+++ b/sys/kern/kern_tc.c
@@ -442,6 +442,16 @@ tc_windup(void)
ncount = 0;
th->th_offset_count += delta;
th->th_offset_count &= th->th_counter->tc_counter_mask;
+ while (delta > th->th_counter->tc_frequency) {
+ /* Eat complete unadjusted seconds. */
+ delta -= th->th_counter->tc_frequency;
+ th->th_offset.sec++;
+ }
+ if ((delta > th->th_counter->tc_frequency / 2) &&
+ (th->th_scale * delta < (uint64_t)1 << 63)) {
+ /* The product th_scale * delta just barely overflows. */
+ th->th_offset.sec++;
+ }
bintime_addx(&th->th_offset, th->th_scale * delta);
/*