diff options
author | andre <andre@FreeBSD.org> | 2005-11-18 16:51:13 +0000 |
---|---|---|
committer | andre <andre@FreeBSD.org> | 2005-11-18 16:51:13 +0000 |
commit | 73d3dcb9b2817f03cef543b2b939cfbe1257eade (patch) | |
tree | 258c66acab17953d8aabe5c97d75ef6ca12b92e9 /sys | |
parent | 17a7a09cd12627344464af8bd7806e9a5ae438e3 (diff) | |
download | FreeBSD-src-73d3dcb9b2817f03cef543b2b939cfbe1257eade.zip FreeBSD-src-73d3dcb9b2817f03cef543b2b939cfbe1257eade.tar.gz |
Add CLOCK_UPTIME to clock_gettime(2) reporting the current
uptime measured in SI seconds.
Sponsored by: TCP/IP Optimization Fundraise 2005
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/kern_time.c | 2 | ||||
-rw-r--r-- | sys/sys/time.h | 1 |
2 files changed, 3 insertions, 0 deletions
diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c index ac838be..fc8f6c7 100644 --- a/sys/kern/kern_time.c +++ b/sys/kern/kern_time.c @@ -224,6 +224,7 @@ kern_clock_gettime(struct thread *td, clockid_t clock_id, struct timespec *ats) TIMEVAL_TO_TIMESPEC(&user, ats); break; case CLOCK_MONOTONIC: + case CLOCK_UPTIME: nanouptime(ats); break; default: @@ -307,6 +308,7 @@ kern_clock_getres(struct thread *td, clockid_t clock_id, struct timespec *ts) switch (clock_id) { case CLOCK_REALTIME: case CLOCK_MONOTONIC: + case CLOCK_UPTIME: /* * Round up the result of the division cheaply by adding 1. * Rounding up is especially important if rounding down diff --git a/sys/sys/time.h b/sys/sys/time.h index e6adbea..60f9543 100644 --- a/sys/sys/time.h +++ b/sys/sys/time.h @@ -238,6 +238,7 @@ struct clockinfo { #define CLOCK_VIRTUAL 1 #define CLOCK_PROF 2 #define CLOCK_MONOTONIC 4 +#define CLOCK_UPTIME 5 #endif #ifndef TIMER_ABSTIME |