kern_tc.c (301af28a06869270844eca0c7e4db2a806fbbcaf) kern_tc.c (5b51d1de62722b33c35f4f1a827069aa0a73a547)
1/*-
2 * ----------------------------------------------------------------------------
3 * "THE BEER-WARE LICENSE" (Revision 42):
4 * <phk@FreeBSD.ORG> wrote this file. As long as you retain this notice you
5 * can do whatever you want with this stuff. If we meet some day, and you think
6 * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
7 * ----------------------------------------------------------------------------
8 */

--- 348 unchanged lines hidden (view full) ---

357/*
358 * Step our concept of UTC. This is done by modifying our estimate of
359 * when we booted.
360 * XXX: not locked.
361 */
362void
363tc_setclock(struct timespec *ts)
364{
1/*-
2 * ----------------------------------------------------------------------------
3 * "THE BEER-WARE LICENSE" (Revision 42):
4 * <phk@FreeBSD.ORG> wrote this file. As long as you retain this notice you
5 * can do whatever you want with this stuff. If we meet some day, and you think
6 * this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
7 * ----------------------------------------------------------------------------
8 */

--- 348 unchanged lines hidden (view full) ---

357/*
358 * Step our concept of UTC. This is done by modifying our estimate of
359 * when we booted.
360 * XXX: not locked.
361 */
362void
363tc_setclock(struct timespec *ts)
364{
365 struct timespec ts2;
365 struct timespec tbef, taft;
366 struct bintime bt, bt2;
367
368 cpu_tick_calibrate(1);
369 nsetclock++;
366 struct bintime bt, bt2;
367
368 cpu_tick_calibrate(1);
369 nsetclock++;
370 binuptime(&bt2);
370 nanotime(&tbef);
371 timespec2bintime(ts, &bt);
371 timespec2bintime(ts, &bt);
372 binuptime(&bt2);
372 bintime_sub(&bt, &bt2);
373 bintime_add(&bt2, &boottimebin);
374 boottimebin = bt;
375 bintime2timeval(&bt, &boottime);
376
377 /* XXX fiddle all the little crinkly bits around the fiords... */
378 tc_windup();
373 bintime_sub(&bt, &bt2);
374 bintime_add(&bt2, &boottimebin);
375 boottimebin = bt;
376 bintime2timeval(&bt, &boottime);
377
378 /* XXX fiddle all the little crinkly bits around the fiords... */
379 tc_windup();
380 nanotime(&taft);
379 if (timestepwarnings) {
381 if (timestepwarnings) {
380 bintime2timespec(&bt2, &ts2);
381 log(LOG_INFO, "Time stepped from %jd.%09ld to %jd.%09ld\n",
382 (intmax_t)ts2.tv_sec, ts2.tv_nsec,
382 log(LOG_INFO,
383 "Time stepped from %jd.%09ld to %jd.%09ld (%jd.%09ld)\n",
384 (intmax_t)tbef.tv_sec, tbef.tv_nsec,
385 (intmax_t)taft.tv_sec, taft.tv_nsec,
383 (intmax_t)ts->tv_sec, ts->tv_nsec);
384 }
385 cpu_tick_calibrate(1);
386}
387
388/*
389 * Initialize the next struct timehands in the ring and make
390 * it the active timehands. Along the way we might switch to a different

--- 555 unchanged lines hidden ---
386 (intmax_t)ts->tv_sec, ts->tv_nsec);
387 }
388 cpu_tick_calibrate(1);
389}
390
391/*
392 * Initialize the next struct timehands in the ring and make
393 * it the active timehands. Along the way we might switch to a different

--- 555 unchanged lines hidden ---