* Step our concept of UTC. This is done by modifying our estimate of * when we booted. */
| 1253 | * when we booted. |
| 1254 | */ |
| 1255 | void |
| 1256 | tc_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 |
no test coverage detected