summaryrefslogtreecommitdiffstats
path: root/sys/kern
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2002-04-26 21:31:44 +0000
committerphk <phk@FreeBSD.org>2002-04-26 21:31:44 +0000
commitd1d55e6cb9412612405c83d273cf677819a841a5 (patch)
tree2d6cf3e9c14f0c8a30d152f6f10c4cc46d797f25 /sys/kern
parent47e5a75efe42b9d1926080e0a6d1787413891b8d (diff)
downloadFreeBSD-src-d1d55e6cb9412612405c83d273cf677819a841a5.zip
FreeBSD-src-d1d55e6cb9412612405c83d273cf677819a841a5.tar.gz
Hide the private parts of timecounter from a couple of places that don't
really need to know the gory details.
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_ntptime.c6
-rw-r--r--sys/kern/kern_tc.c14
-rw-r--r--sys/kern/kern_time.c2
3 files changed, 13 insertions, 9 deletions
diff --git a/sys/kern/kern_ntptime.c b/sys/kern/kern_ntptime.c
index 34771c2..cd2db73 100644
--- a/sys/kern/kern_ntptime.c
+++ b/sys/kern/kern_ntptime.c
@@ -436,13 +436,11 @@ done2:
* simulation.
*/
void
-ntp_update_second(struct timecounter *tcp)
+ntp_update_second(int64_t *adjustment, time_t *newsec)
{
- u_int32_t *newsec;
int tickrate;
l_fp ftemp; /* 32/64-bit temporary */
- newsec = &tcp->tc_offset.sec;
/*
* On rollover of the second both the nanosecond and microsecond
* clocks are updated and the state machine cranked as
@@ -558,7 +556,7 @@ ntp_update_second(struct timecounter *tcp)
L_LINT(ftemp, tickrate * 1000);
L_ADD(time_adj, ftemp);
}
- tcp->tc_adjustment = time_adj;
+ *adjustment = time_adj;
#ifdef PPS_SYNC
if (pps_valid > 0)
diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c
index fe07aec..23c85cf 100644
--- a/sys/kern/kern_tc.c
+++ b/sys/kern/kern_tc.c
@@ -312,6 +312,13 @@ tc_setclock(struct timespec *ts)
tc_windup();
}
+u_int32_t
+tc_getfrequency(void)
+{
+
+ return (timecounter->tc_frequency);
+}
+
static void
switch_timecounter(struct timecounter *newtc)
{
@@ -362,10 +369,9 @@ tc_windup(void)
*/
if (tco->tc_poll_pps)
tco->tc_poll_pps(tco);
- for (i = tc->tc_offset.sec - tco->tc_offset.sec; i > 0; i--) {
- ntp_update_second(tc); /* XXX only needed if xntpd runs */
- tc_setscales(tc);
- }
+ for (i = tc->tc_offset.sec - tco->tc_offset.sec; i > 0; i--)
+ ntp_update_second(&tc->tc_adjustment, &tc->tc_offset.sec);
+ tc_setscales(tc);
bt = tc->tc_offset;
bintime_add(&bt, &boottimebin);
diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c
index fd86212..645170e 100644
--- a/sys/kern/kern_time.c
+++ b/sys/kern/kern_time.c
@@ -222,7 +222,7 @@ clock_getres(td, uap)
error = 0;
if (SCARG(uap, tp)) {
ts.tv_sec = 0;
- ts.tv_nsec = 1000000000 / timecounter->tc_frequency;
+ ts.tv_nsec = 1000000000 / tc_getfrequency();
error = copyout(&ts, SCARG(uap, tp), sizeof(ts));
}
return (error);
OpenPOWER on IntegriCloud