Changeset View
Changeset View
Standalone View
Standalone View
sys/kern/kern_tc.c
Show First 20 Lines • Show All 1,239 Lines • ▼ Show 20 Lines | |||||
static struct mtx tc_setclock_mtx; | static struct mtx tc_setclock_mtx; | ||||
MTX_SYSINIT(tc_setclock_init, &tc_setclock_mtx, "tcsetc", MTX_SPIN); | MTX_SYSINIT(tc_setclock_init, &tc_setclock_mtx, "tcsetc", MTX_SPIN); | ||||
/* | /* | ||||
* Step our concept of UTC. This is done by modifying our estimate of | * Step our concept of UTC. This is done by modifying our estimate of | ||||
* when we booted. | * when we booted. | ||||
*/ | */ | ||||
void | void | ||||
tc_setclock(struct timespec *ts) | tc_setclock(struct timespec *ts, bool abs) | ||||
{ | { | ||||
struct timespec tbef, taft; | struct timespec tbef, taft; | ||||
struct bintime bt, bt2; | struct bintime bt, bt2; | ||||
timespec2bintime(ts, &bt); | timespec2bintime(ts, &bt); | ||||
nanotime(&tbef); | nanotime(&tbef); | ||||
mtx_lock_spin(&tc_setclock_mtx); | mtx_lock_spin(&tc_setclock_mtx); | ||||
cpu_tick_calibrate(1); | cpu_tick_calibrate(1); | ||||
if (abs) { | |||||
binuptime(&bt2); | binuptime(&bt2); | ||||
bintime_sub(&bt, &bt2); | bintime_sub(&bt, &bt2); | ||||
} | |||||
cy: Correct me if I'm wrong, it appears all callers to tc_setclock() set bool abs to true. I see… | |||||
Done Inline ActionsLook at steptime() call from kern_clock_settime(case CLOCK_ADJUST_REALTIME). kib: Look at steptime() call from kern_clock_settime(case CLOCK_ADJUST_REALTIME). | |||||
Done Inline ActionsThank you. cy: Thank you. | |||||
/* XXX fiddle all the little crinkly bits around the fiords... */ | /* | ||||
* Fiddle all the little crinkly bits around the fiords... | |||||
*/ | |||||
tc_windup(&bt); | tc_windup(&bt); | ||||
mtx_unlock_spin(&tc_setclock_mtx); | mtx_unlock_spin(&tc_setclock_mtx); | ||||
/* Avoid rtc_generation == 0, since td_rtcgen == 0 is special. */ | /* Avoid rtc_generation == 0, since td_rtcgen == 0 is special. */ | ||||
atomic_add_rel_int(&rtc_generation, 2); | atomic_add_rel_int(&rtc_generation, 2); | ||||
sleepq_chains_remove_matching(sleeping_on_old_rtc); | sleepq_chains_remove_matching(sleeping_on_old_rtc); | ||||
if (timestepwarnings) { | if (timestepwarnings) { | ||||
nanotime(&taft); | nanotime(&taft); | ||||
▲ Show 20 Lines • Show All 906 Lines • Show Last 20 Lines |
Correct me if I'm wrong, it appears all callers to tc_setclock() set bool abs to true. I see only two callers of tc_setclock(). One in kern/kern_time.c and the other in kern/subr_rtc.c, both of which call tc_setclock() with abs = true.