Add CLOCK_UPTIME to clock_gettime(2) reporting the current

uptime measured in SI seconds.

Sponsored by:	TCP/IP Optimization Fundraise 2005
This commit is contained in:
Andre Oppermann 2005-11-18 16:51:13 +00:00
parent e8fbd4a86d
commit 5eefd88949
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=152585
2 changed files with 3 additions and 0 deletions

View file

@ -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

View file

@ -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