summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2003-02-23 10:18:31 +0000
committerphk <phk@FreeBSD.org>2003-02-23 10:18:31 +0000
commit4ddaec005db6c8979036cda04c988eb5d69d4cb3 (patch)
tree7e6335ead53af0469220f3f9e4b93a9cfa4dc53f
parent8fafb8765a84c33765f647a404b0efcc88cbe946 (diff)
downloadFreeBSD-src-4ddaec005db6c8979036cda04c988eb5d69d4cb3.zip
FreeBSD-src-4ddaec005db6c8979036cda04c988eb5d69d4cb3.tar.gz
Implement CLOCK_MONOTONIC.
-rw-r--r--sys/kern/kern_time.c5
-rw-r--r--sys/sys/time.h1
2 files changed, 4 insertions, 2 deletions
diff --git a/sys/kern/kern_time.c b/sys/kern/kern_time.c
index 4a8ef92..7dfa098 100644
--- a/sys/kern/kern_time.c
+++ b/sys/kern/kern_time.c
@@ -160,8 +160,9 @@ clock_gettime(struct thread *td, struct clock_gettime_args *uap)
struct timespec ats;
if (uap->clock_id != CLOCK_REALTIME)
- return (EINVAL);
- nanotime(&ats);
+ nanotime(&ats);
+ else if (uap->clock_id != CLOCK_MONOTONIC)
+ nanouptime(&ats);
return (copyout(&ats, uap->tp, sizeof(ats)));
}
diff --git a/sys/sys/time.h b/sys/sys/time.h
index 86d50a5..b713bb8 100644
--- a/sys/sys/time.h
+++ b/sys/sys/time.h
@@ -243,6 +243,7 @@ struct clockinfo {
#endif
#define CLOCK_VIRTUAL 1
#define CLOCK_PROF 2
+#define CLOCK_MONOTONIC 4
#define TIMER_RELTIME 0x0 /* relative timer */
#ifndef TIMER_ABSTIME
OpenPOWER on IntegriCloud