From 235077ef62972b0926cc2ffc1dd2e91f3a63a463 Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Wed, 9 Apr 2008 21:41:59 +0000 Subject: [PATCH] Bring the list of variables and function docs in time(9) closer to reality. Derived-from: FreeBSD --- Makefile_upgrade.inc | 6 ++- share/man/man9/Makefile | 5 +- share/man/man9/time.9 | 121 ++++++++++++------------------------------------ 3 files changed, 37 insertions(+), 95 deletions(-) diff --git a/Makefile_upgrade.inc b/Makefile_upgrade.inc index 2184fc5d46..189f9195e3 100644 --- a/Makefile_upgrade.inc +++ b/Makefile_upgrade.inc @@ -1,4 +1,4 @@ -# $DragonFly: src/Makefile_upgrade.inc,v 1.19 2008/03/30 00:32:33 swildner Exp $ +# $DragonFly: src/Makefile_upgrade.inc,v 1.20 2008/04/09 21:41:58 swildner Exp $ # # Append all obsolete files to this file # Avoid constructs like {foo,bar}. It is parsed by /bin/sh @@ -570,3 +570,7 @@ TO_REMOVE+=/usr/share/man/cat8/ipwcontrol.8.gz TO_REMOVE+=/usr/share/man/man8/ipwcontrol.8.gz TO_REMOVE+=/usr/share/zoneinfo/Asia/Calcutta TO_REMOVE+=/usr/share/zoneinfo/Asia/Saigon +TO_REMOVE+=/usr/share/man/cat9/mono_time.9 +TO_REMOVE+=/usr/share/man/man9/mono_time.9 +TO_REMOVE+=/usr/share/man/cat9/runtime.9 +TO_REMOVE+=/usr/share/man/man9/runtime.9 diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile index d21278c493..c57916d928 100644 --- a/share/man/man9/Makefile +++ b/share/man/man9/Makefile @@ -1,5 +1,5 @@ # $FreeBSD: src/share/man/man9/Makefile,v 1.60.2.26 2003/06/13 01:04:17 hmp Exp $ -# $DragonFly: src/share/man/man9/Makefile,v 1.72 2008/03/16 17:29:51 swildner Exp $ +# $DragonFly: src/share/man/man9/Makefile,v 1.73 2008/04/09 21:41:58 swildner Exp $ MAN= accept_filter.9 \ accf_data.9 \ @@ -582,8 +582,7 @@ MLINKS+=taskqueue.9 TASK_INIT.9 \ taskqueue.9 taskqueue_free.9 \ taskqueue.9 taskqueue_run.9 MLINKS+=time.9 boottime.9 \ - time.9 mono_time.9 \ - time.9 runtime.9 + time.9 time_second.9 MLINKS+=tvtohz.9 tvtohz_high.9 \ tvtohz.9 tvtohz_low.9 MLINKS+=uio.9 uiomove.9 diff --git a/share/man/man9/time.9 b/share/man/man9/time.9 index 47987d3c38..ba17b3b9a0 100644 --- a/share/man/man9/time.9 +++ b/share/man/man9/time.9 @@ -30,112 +30,51 @@ .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" .\" $FreeBSD: src/share/man/man9/time.9,v 1.3.2.5 2001/08/17 13:08:54 ru Exp $ -.\" $DragonFly: src/share/man/man9/time.9,v 1.2 2003/06/17 04:37:01 dillon Exp $ +.\" $DragonFly: src/share/man/man9/time.9,v 1.3 2008/04/09 21:41:59 swildner Exp $ .\" -.Dd March 22, 1997 +.Dd April 9, 2008 .Dt TIME 9 .Os .Sh NAME .Nm boottime , -.Nm mono_time , -.Nm runtime , -.Nm time +.Nm time_second .Nd system time variables .Sh SYNOPSIS -.Bl -item -compact -.It -.Va extern struct timeval boottime ; -.It -.Va extern volatile struct timeval mono_time ; -.It -.Va extern struct timeval runtime ; -.It -.Va extern struct timeval time ; -.El -.Sh DESCRIPTION -The -.Va time -variable is the system's -.Dq wall time -clock. -It is set at boot by -.Xr inittodr 9 , -and is updated by the -.Xr settimeofday 2 -system call and by periodic clock interrupts. +.In sys/time.h .Pp +.Vt extern struct timeval boottime ; +.Vt extern time_t time_second ; +.Sh DESCRIPTION The .Va boottime -variable holds the system boot time. It is set from -.Va time -at system boot, and is updated when the system time is adjusted -with -.Xr settimeofday 2 . -.Pp -The -.Va runtime -variable holds the time that the system switched to the -current process. -It is set after each context switch, -and is updated when the system time is adjusted with -.Xr settimeofday 2 . -Because -.Va runtime -is used for system accounting, it is set with the high-resolution -.Xr microtime 9 -function, rather than being copied from -.Va time . -.Pp +variable holds the system boot time. The -.Va mono_time -variable is a monotonically increasing system clock. It is set -from -.Va time -at boot, and is updated by the periodic timer interrupt. (It is -not updated by -.Xr settimeofday 2 . ) -.Pp -All of these variables contain times -expressed in seconds and microseconds since midnight (0 hour), -January 1, 1970. +.Va time_second +variable is the system's +.Dq wall time +clock to the second. .Pp -Clock interrupts should be blocked -when reading or writing -.Va time -or -.Va mono_time , -because those variables are updated by -.Fn hardclock . -The -.Xr gettime 9 -function can be used to read the -.Va time -variable in an atomic manner. There is no equivalent -function for accessing -.Va mono_time . The -.Va boottime +.Xr microtime 9 , +.Xr getmicrotime 9 , +.Xr nanotime 9 , and -.Va runtime -variables may be read and written without special precautions. -.Pp -It should be noted that due to the differences in how the time values -returned by -.Xr gettime 9 +.Xr getnanotime 9 +functions can be used to get the current time in an atomic manner. +Similarly, the +.Xr microuptime 9 , +.Xr getmicrouptime 9 , +.Xr nanouptime 9 , and -.Xr microtime 9 -are updated, comparing the results of the two routines -may result in a time value that appears to go backwards. -This can be avoided by consistently using one function or the other -for use in any given context. +.Xr getnanouptime 9 +functions can be used to get the time elapsed since boot in an atomic manner. +The +.Va boottime +variable may be read and written without special precautions. .Sh SEE ALSO +.Xr clock_settime 2 , +.Xr ntp_adjtime 2 , .Xr settimeofday 2 , -.Xr gettime 9 , -.\" .Xr hardclock 9 , -.\" .Xr hz 9 , .Xr inittodr 9 , -.Xr microtime 9 -.Sh BUGS -The notion of having a single -.Va runtime -variable obviously would not be appropriate in multiprocessor systems. +.Xr microtime 9 , +.Xr microuptime 9 -- 2.11.4.GIT