1 .\" $NetBSD: time.9,v 1.1 1995/11/25 21:24:53 perry Exp $
3 .\" Copyright (c) 1994 Christopher G. Demetriou
4 .\" All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
14 .\" 3. All advertising materials mentioning features or use of this software
15 .\" must display the following acknowledgement:
16 .\" This product includes software developed by Christopher G. Demetriou
17 .\" for the NetBSD Project.
18 .\" 3. The name of the author may not be used to endorse or promote products
19 .\" derived from this software without specific prior written permission
21 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42 .Nd system time variables
44 .Va extern struct timeval boottime;
46 .Va extern volatile struct timeval mono_time;
48 .Va extern struct timeval runtime;
50 .Va extern struct timeval time;
54 variable is the system's
61 system call and by periodic clock interrupts.
65 variable holds the system boot time. It is set from
67 at system boot, and is updated when the system time is adjusted
73 variable holds the time that the system switched to the
75 It is set after each context switch,
76 and is updated when the system time is adjusted with
80 is used for system accounting, it is set with the high-resolution
82 function, rather than being copied from
87 variable is a monotonically increasing system clock. It is set
90 at boot, and is updated by the periodic timer interrupt. (It is
94 All of these variables contain times
95 expressed in seconds and microseconds since midnight (0 hour),
98 Clock interrupts should be blocked
99 when reading or writing
103 because those variables are updated by
107 function can be used to read the
109 variable in an atomic manner. There is no equivalent
110 function for accessing
116 variables may be read and written without special precautions.
118 It should be noted that due to the differences in how the time values
123 are updated, comparing the results of the two routines
124 may result in a time value that appears to go backwards.
125 This can be avoided by consistently using one function or the other
126 for use in any given context.
131 .\" .Xr hardclock 9 ,
135 The notion of having a single
137 variable obviously would not be appropriate in multiprocessor systems.