summaryrefslogtreecommitdiff
path: root/sys/kern/kern_tc.c
diff options
context:
space:
mode:
authorPhilip Guenther <guenther@cvs.openbsd.org>2013-10-06 01:27:51 +0000
committerPhilip Guenther <guenther@cvs.openbsd.org>2013-10-06 01:27:51 +0000
commit8f27a4bba12b2ef9ab720af391064d39d1258362 (patch)
tree5ec500ca8d7f82bef55a8fb361313381065134fe /sys/kern/kern_tc.c
parent214c9c0119954cbe8f50e81b4998d79a016914cd (diff)
Add CLOCK_UPTIME, a clock which measures time-running-not-suspended, so
that mlarkin@ can fix programs that report rates-over-uptime. ok kettenis@ manpage corrections jmc@ (which I've probably broken again)
Diffstat (limited to 'sys/kern/kern_tc.c')
-rw-r--r--sys/kern/kern_tc.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/sys/kern/kern_tc.c b/sys/kern/kern_tc.c
index 7b988a33dfc..241aaa9e080 100644
--- a/sys/kern/kern_tc.c
+++ b/sys/kern/kern_tc.c
@@ -6,7 +6,7 @@
* this stuff is worth it, you can buy me a beer in return. Poul-Henning Kamp
* ----------------------------------------------------------------------------
*
- * $OpenBSD: kern_tc.c,v 1.20 2013/06/03 16:55:22 guenther Exp $
+ * $OpenBSD: kern_tc.c,v 1.21 2013/10/06 01:27:49 guenther Exp $
* $FreeBSD: src/sys/kern/kern_tc.c,v 1.148 2003/03/18 08:45:23 phk Exp $
*/
@@ -95,7 +95,7 @@ static struct timecounter *timecounters = &dummy_timecounter;
volatile time_t time_second = 1;
volatile time_t time_uptime = 0;
-extern struct timeval adjtimedelta;
+struct bintime naptime;
static struct bintime boottimebin;
static int timestepwarnings;
@@ -339,9 +339,13 @@ tc_setclock(struct timespec *ts)
bt2 = timehands->th_offset;
timehands->th_offset = bt;
+ /* XXX fiddle all the little crinkly bits around the fiords... */
+ tc_windup();
+
#ifndef SMALL_KERNEL
/* convert the bintime to ticks */
bintime_sub(&bt, &bt2);
+ bintime_add(&naptime, &bt);
adj_ticks = (long long)hz * bt.sec +
(((uint64_t)1000000 * (uint32_t)(bt.frac >> 32)) >> 32) / tick;
if (adj_ticks > 0) {
@@ -350,9 +354,6 @@ tc_setclock(struct timespec *ts)
timeout_adjust_ticks(adj_ticks);
}
#endif
-
- /* XXX fiddle all the little crinkly bits around the fiords... */
- tc_windup();
}
/*