2005-10-01 08:09:06 +04:00
|
|
|
.\" $NetBSD: time.9,v 1.15 2005/10/01 04:09:06 yamt Exp $
|
1995-11-26 00:24:47 +03:00
|
|
|
.\"
|
|
|
|
.\" Copyright (c) 1994 Christopher G. Demetriou
|
|
|
|
.\" All rights reserved.
|
2001-09-04 06:51:15 +04:00
|
|
|
.\"
|
1995-11-26 00:24:47 +03:00
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\" 3. All advertising materials mentioning features or use of this software
|
|
|
|
.\" must display the following acknowledgement:
|
2000-06-14 21:24:02 +04:00
|
|
|
.\" This product includes software developed for the
|
2003-02-14 18:20:17 +03:00
|
|
|
.\" NetBSD Project. See http://www.NetBSD.org/ for
|
2000-06-14 21:24:02 +04:00
|
|
|
.\" information about NetBSD.
|
1999-04-07 00:24:37 +04:00
|
|
|
.\" 4. The name of the author may not be used to endorse or promote products
|
2000-06-14 21:24:02 +04:00
|
|
|
.\" derived from this software without specific prior written permission.
|
2001-09-04 06:51:15 +04:00
|
|
|
.\"
|
1995-11-26 00:24:47 +03:00
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
2001-09-04 06:51:15 +04:00
|
|
|
.\"
|
2000-06-14 21:24:02 +04:00
|
|
|
.\" <<Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp>>
|
1995-11-26 00:24:47 +03:00
|
|
|
.\"
|
2005-10-01 08:09:06 +04:00
|
|
|
.Dd October 1, 2005
|
1995-11-26 00:24:47 +03:00
|
|
|
.Dt TIME 9
|
1999-03-16 03:40:46 +03:00
|
|
|
.Os
|
1995-11-26 00:24:47 +03:00
|
|
|
.Sh NAME
|
|
|
|
.Nm boottime ,
|
|
|
|
.Nm mono_time ,
|
|
|
|
.Nm time
|
|
|
|
.Nd system time variables
|
|
|
|
.Sh SYNOPSIS
|
|
|
|
.Va extern struct timeval boottime;
|
|
|
|
.br
|
|
|
|
.Va extern volatile struct timeval mono_time;
|
|
|
|
.br
|
|
|
|
.Va extern volatile struct timeval time;
|
|
|
|
.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.
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Va boottime
|
2002-10-14 17:43:14 +04:00
|
|
|
variable holds the system boot time.
|
|
|
|
It is set from
|
1995-11-26 00:24:47 +03:00
|
|
|
.Va time
|
|
|
|
at system boot, and is updated when the system time is adjusted
|
|
|
|
with
|
|
|
|
.Xr settimeofday 2 .
|
|
|
|
.Pp
|
|
|
|
The
|
|
|
|
.Va mono_time
|
2002-10-14 17:43:14 +04:00
|
|
|
variable is a monotonically increasing system clock.
|
|
|
|
It is set from
|
1995-11-26 00:24:47 +03:00
|
|
|
.Va time
|
2002-10-14 17:43:14 +04:00
|
|
|
at boot, and is updated by the periodic timer interrupt.
|
|
|
|
(It is not updated by
|
2001-09-04 07:00:46 +04:00
|
|
|
.Xr settimeofday 2 . )
|
1995-11-26 00:24:47 +03:00
|
|
|
.Pp
|
|
|
|
All of these variables contain times
|
|
|
|
expressed in seconds and microseconds since midnight (0 hour),
|
|
|
|
January 1, 1970.
|
|
|
|
.Pp
|
|
|
|
Clock interrupts should be blocked
|
|
|
|
when reading or writing
|
|
|
|
.Va time
|
|
|
|
or
|
|
|
|
.Va mono_time ,
|
|
|
|
because those variables are updated by
|
|
|
|
.Fn hardclock .
|
1998-06-08 15:32:58 +04:00
|
|
|
.Va boottime
|
1995-11-26 00:24:47 +03:00
|
|
|
and
|
|
|
|
.Va runtime
|
|
|
|
may be read and written without special precautions.
|
|
|
|
.Sh SEE ALSO
|
2001-09-04 08:03:50 +04:00
|
|
|
.Xr settimeofday 2 ,
|
2002-08-07 17:43:33 +04:00
|
|
|
.Xr hardclock 9 ,
|
2001-09-04 08:03:50 +04:00
|
|
|
.Xr hz 9 ,
|
1995-11-26 00:24:47 +03:00
|
|
|
.Xr inittodr 9 ,
|
2001-09-04 08:03:50 +04:00
|
|
|
.Xr microtime 9
|