--- src/share/man/man9/time.9 2003/06/17 04:37:01 1.2 +++ src/share/man/man9/time.9 2008/04/09 21:41:59 1.3 @@ -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.1 2003/06/16 05:38:39 dillon Exp $ +.\" $DragonFly$ .\" -.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