summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorimp <imp@FreeBSD.org>2003-08-20 19:12:46 +0000
committerimp <imp@FreeBSD.org>2003-08-20 19:12:46 +0000
commitee0d294c7ec9da383edaa9507c4f1cd83dfb9a6e (patch)
tree13fb811632da83d51ab3cf650e07875030f6dc84 /sys/kern
parentf0a28c0844b83992ea192af911302d791bc5d90a (diff)
downloadFreeBSD-src-ee0d294c7ec9da383edaa9507c4f1cd83dfb9a6e.zip
FreeBSD-src-ee0d294c7ec9da383edaa9507c4f1cd83dfb9a6e.tar.gz
bde made a number of suggested improvements to the code. This commit
represents the pruely stylistic changes and should have no net impact on the rest of the code. bde's more substantive changes will follow in a separate commit once we've come to closure on them. Submitted by: bde
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_tc.c37
1 files changed, 17 insertions, 20 deletions
diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c
index 005936f..e0a6e15 100644
--- a/sys/kern/kern_tc.c
+++ b/sys/kern/kern_tc.c
@@ -21,10 +21,10 @@ __FBSDID("$FreeBSD$");
#include <sys/timex.h>
/*
- * a large step happens on boot. This constant detects such
- * a steps. It is relatively small so that ntp_update_second gets called
- * enough in the typical 'missed a couple of seconds' case, but doesn't
- * loop forever when the time step is large.
+ * A large step happens on boot. This constant detects such steps.
+ * It is relatively small so that ntp_update_second gets called enough
+ * in the typical 'missed a couple of seconds' case, but doesn't loop
+ * forever when the time step is large.
*/
#define LARGE_STEP 200
@@ -321,7 +321,7 @@ tc_getfrequency(void)
/*
* Step our concept of UTC. This is done by modifying our estimate of
- * when we booted. XXX: needs futher work.
+ * when we booted. XXX: needs further work.
*/
void
tc_setclock(struct timespec *ts)
@@ -394,21 +394,17 @@ tc_windup(void)
if (tho->th_counter->tc_poll_pps)
tho->th_counter->tc_poll_pps(tho->th_counter);
- /*
- * Compute the UTC time, before any leapsecond adjustments, are
- * made.
+ /*
+ * Deal with NTP second processing. The for loop normally
+ * iterates at most once, but in extreme situations it might
+ * keep NTP sane if timeouts are not run for several seconds.
+ * At boot, the time step can be large when the TOD hardware
+ * has been read, so on really large steps, we call
+ * ntp_update_second only twice. We need to call it twice in
+ * case we missed a leap second.
*/
bt = th->th_offset;
bintime_add(&bt, &boottimebin);
-
- /*
- * Deal with NTP second processing. The for loop normally only
- * iterates once, but in extreme situations it might keep NTP sane
- * if timeouts are not run for several seconds. At boot, the
- * time step can be large when the TOD hardware has been read, so
- * on really large steps, we call ntp_update_second only twice.
- * We need to call it twice in case we missed a leap second.
- */
i = bt.sec - tho->th_microtime.tv_sec;
if (i > LARGE_STEP)
i = 2;
@@ -418,6 +414,10 @@ tc_windup(void)
if (bt.sec != t)
boottimebin.sec += bt.sec - t;
}
+ /* Update the UTC timestamps used by the get*() functions. */
+ /* XXX shouldn't do this here. Should force non-`get' versions. */
+ bintime2timeval(&bt, &th->th_microtime);
+ bintime2timespec(&bt, &th->th_nanotime);
/* Now is a good time to change timecounters. */
if (th->th_counter != timecounter) {
@@ -453,9 +453,6 @@ tc_windup(void)
scale /= th->th_counter->tc_frequency;
th->th_scale = scale * 2;
- bintime2timeval(&bt, &th->th_microtime);
- bintime2timespec(&bt, &th->th_nanotime);
-
/*
* Now that the struct timehands is again consistent, set the new
* generation number, making sure to not make it zero.
OpenPOWER on IntegriCloud