xref: /netbsd-src/share/man/man9/time_second.9 (revision b7ae68fde0d8ef1c03714e8bbb1ee7c6118ea93b)
1.\" $NetBSD: time_second.9,v 1.1 2006/09/06 18:04:30 gdamore Exp $
2.\"
3.\" Copyright (c) 1994 Christopher G. Demetriou
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
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 for the
17.\"          NetBSD Project.  See http://www.NetBSD.org/ for
18.\"          information about NetBSD.
19.\" 4. The name of the author may not be used to endorse or promote products
20.\"    derived from this software without specific prior written permission.
21.\"
22.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
23.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32.\"
33.\" <<Id: LICENSE,v 1.2 2000/06/14 15:57:33 cgd Exp>>
34.\"
35.Dd September 6, 2006
36.Dt TIME_SECOND 9
37.Os
38.Sh NAME
39.Nm boottime ,
40.Nm time_second ,
41.Nm time_uptime
42.Nd system time variables
43.Sh SYNOPSIS
44.Va extern struct timeval boottime;
45.br
46.Va extern time_t time_uptime;
47.br
48.Va extern time_t time_second;
49.Sh DESCRIPTION
50The
51.Va time_second
52variable is the system's
53.Dq wall time
54clock.
55It is set at boot by
56.Xr inittodr 9 ,
57and is updated by the
58.Xr settimeofday 2
59system call and by periodic clock interrupts.
60.Pp
61The
62.Va boottime
63variable holds the system boot time.
64It is set from
65.Va time
66at system boot, and is updated when the system time is adjusted
67with
68.Xr settimeofday 2 .
69.Pp
70The
71.Va time_uptime
72variable is a monotonically increasing system clock.
73It is set from
74.Va time_second
75at boot, and is updated by the periodic timer interrupt.
76(It is not updated by
77.Xr settimeofday 2 . )
78.Pp
79All of these variables contain times
80expressed in seconds and microseconds since midnight (0 hour),
81January 1, 1970.
82.Pp
83Clock interrupts should be blocked
84when reading or writing
85.Va time_second
86or
87.Va time_uptime ,
88because those variables are updated by
89.Fn hardclock .
90.Va boottime
91and
92.Va runtime
93may be read and written without special precautions.
94.Sh SEE ALSO
95.Xr settimeofday 2 ,
96.Xr hardclock 9 ,
97.Xr hz 9 ,
98.Xr inittodr 9 ,
99.Xr microtime 9
100