MCPcopy Create free account
hub / github.com/F-Stack/f-stack / tc_setclock

Function tc_setclock

freebsd/kern/kern_tc.c:1255–1283  ·  view source on GitHub ↗

* Step our concept of UTC. This is done by modifying our estimate of * when we booted. */

Source from the content-addressed store, hash-verified

1253 * when we booted.
1254 */
1255void
1256tc_setclock(struct timespec *ts)
1257{
1258 struct timespec tbef, taft;
1259 struct bintime bt, bt2;
1260
1261 timespec2bintime(ts, &bt);
1262 nanotime(&tbef);
1263 mtx_lock_spin(&tc_setclock_mtx);
1264 cpu_tick_calibrate(1);
1265 binuptime(&bt2);
1266 bintime_sub(&bt, &bt2);
1267
1268 /* XXX fiddle all the little crinkly bits around the fiords... */
1269 tc_windup(&bt);
1270 mtx_unlock_spin(&tc_setclock_mtx);
1271
1272 /* Avoid rtc_generation == 0, since td_rtcgen == 0 is special. */
1273 atomic_add_rel_int(&rtc_generation, 2);
1274 sleepq_chains_remove_matching(sleeping_on_old_rtc);
1275 if (timestepwarnings) {
1276 nanotime(&taft);
1277 log(LOG_INFO,
1278 "Time stepped from %jd.%09ld to %jd.%09ld (%jd.%09ld)\n",
1279 (intmax_t)tbef.tv_sec, tbef.tv_nsec,
1280 (intmax_t)taft.tv_sec, taft.tv_nsec,
1281 (intmax_t)ts->tv_sec, ts->tv_nsec);
1282 }
1283}
1284
1285/*
1286 * Initialize the next struct timehands in the ring and make

Callers 2

inittodrFunction · 0.85
settimeFunction · 0.85

Calls 7

timespec2bintimeFunction · 0.85
nanotimeFunction · 0.85
cpu_tick_calibrateFunction · 0.85
binuptimeFunction · 0.85
bintime_subFunction · 0.85
logFunction · 0.70

Tested by

no test coverage detected