mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-12 14:29:28 +00:00
Hide the private parts of timecounter from a couple of places that don't
really need to know the gory details.
This commit is contained in:
parent
14021ab570
commit
b4a1d0deb1
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=95529
@ -436,13 +436,11 @@ ntp_adjtime(struct thread *td, struct ntp_adjtime_args *uap)
|
||||
* 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)
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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 */
|
||||
|
@ -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>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user