diff options
Diffstat (limited to 'sys')
| -rw-r--r-- | sys/kern/kern_ntptime.c | 6 | ||||
| -rw-r--r-- | sys/kern/kern_tc.c | 14 | ||||
| -rw-r--r-- | sys/kern/kern_time.c | 2 | ||||
| -rw-r--r-- | sys/sys/timetc.h | 1 | ||||
| -rw-r--r-- | sys/sys/timex.h | 4 |
5 files changed, 16 insertions, 11 deletions
diff --git a/sys/kern/kern_ntptime.c b/sys/kern/kern_ntptime.c index 34771c20118b..cd2db730342c 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 fe07aec9bc58..23c85cf0a97f 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 fd8621298614..645170ecda07 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); diff --git a/sys/sys/timetc.h b/sys/sys/timetc.h index 5b212fe5c26f..a35f6fb32cd9 100644 --- a/sys/sys/timetc.h +++ b/sys/sys/timetc.h @@ -93,6 +93,7 @@ struct timecounter { #ifdef _KERNEL extern struct timecounter *volatile timecounter; +u_int32_t tc_getfrequency(void); void tc_init(struct timecounter *tc); void tc_setclock(struct timespec *ts); #endif /* !_KERNEL */ diff --git a/sys/sys/timex.h b/sys/sys/timex.h index 7cdeea00f427..a4379fea3f11 100644 --- a/sys/sys/timex.h +++ b/sys/sys/timex.h @@ -220,8 +220,8 @@ struct timex { #ifdef __FreeBSD__ #ifdef _KERNEL -struct timecounter; -void ntp_update_second(struct timecounter *tc); +struct timehands; +void ntp_update_second(int64_t *adjustment, time_t *newsec); #else /* !_KERNEL */ #include <sys/cdefs.h> |
