diff options
author | cheloha <cheloha@cvs.openbsd.org> | 2017-12-18 05:51:54 +0000 |
---|---|---|
committer | cheloha <cheloha@cvs.openbsd.org> | 2017-12-18 05:51:54 +0000 |
commit | 8e394bb0e5f25c84775150ebb5389670cae488c7 (patch) | |
tree | e2716e9835a7872f76ef5fcfa82893972f1624c4 /lib/libc | |
parent | 8fd06186df470fde0080330a0b2f5829bf0c6a1d (diff) |
Add the CLOCK_BOOTTIME clockid for use with clock_gettime(2)
and put it to use in userspace in lieu of the kern.boottime
sysctl.
Its absolute value is the time that has elapsed since the
system booted, i.e., the system uptime.
Use in top(1), w(1), and snmpd(8) eliminates a race with
settimeofday(2), adjtime(2), etc. inherent to deriving the
system uptime via the kern.boottime sysctl.
Product of a great deal of discussion/revision with jca@, tb@,
and guenther@.
ok tb@ jca@ guenther@ dlg@ mlarkin@ tom@
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/sys/clock_gettime.2 | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/lib/libc/sys/clock_gettime.2 b/lib/libc/sys/clock_gettime.2 index 1e4c93ed7ae..cb06d8df241 100644 --- a/lib/libc/sys/clock_gettime.2 +++ b/lib/libc/sys/clock_gettime.2 @@ -1,4 +1,4 @@ -.\" $OpenBSD: clock_gettime.2,v 1.27 2015/09/10 17:55:21 schwarze Exp $ +.\" $OpenBSD: clock_gettime.2,v 1.28 2017/12/18 05:51:53 cheloha Exp $ .\" .\" Copyright (c) 1980, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -27,7 +27,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd $Mdocdate: September 10 2015 $ +.Dd $Mdocdate: December 18 2017 $ .Dt CLOCK_GETTIME 2 .Os .Sh NAME @@ -73,6 +73,9 @@ time that increments as a wall clock should but whose absolute value is meaningless and cannot jump, providing accurate realtime interval measurement, even across suspend and resume +.It Dv CLOCK_BOOTTIME +time whose absolute value is the time that has elapsed since the +system was booted .It Dv CLOCK_UPTIME time whose absolute value is the time the system has been running and not suspended, @@ -157,8 +160,10 @@ functions conform to .St -p1003.1-2008 . .Pp The +.Dv CLOCK_BOOTTIME +and .Dv CLOCK_UPTIME -clock is an extension to that. +clocks are extensions to that. .Sh HISTORY The .Dv CLOCK_PROCESS_CPUTIME_ID @@ -174,3 +179,11 @@ and was added to .Ox in .Ox 5.5 . +The +.Dv CLOCK_BOOTTIME +clock first appeared in +Linux 2.6.39 +and was added to +.Ox +in +.Ox 6.3 . |