2 .\" Sun Microsystems, Inc. gratefully acknowledges The Open Group for
3 .\" permission to reproduce portions of its copyrighted documentation.
4 .\" Original documentation from The Open Group can be obtained online at
5 .\" http://www.opengroup.org/bookstore/.
7 .\" The Institute of Electrical and Electronics Engineers and The Open
8 .\" Group, have given us permission to reprint portions of their
11 .\" In the following statement, the phrase ``this text'' refers to portions
12 .\" of the system documentation.
14 .\" Portions of this text are reprinted and reproduced in electronic form
15 .\" in the SunOS Reference Manual, from IEEE Std 1003.1, 2004 Edition,
16 .\" Standard for Information Technology -- Portable Operating System
17 .\" Interface (POSIX), The Open Group Base Specifications Issue 6,
18 .\" Copyright (C) 2001-2004 by the Institute of Electrical and Electronics
19 .\" Engineers, Inc and The Open Group. In the event of any discrepancy
20 .\" between these versions and the original IEEE and The Open Group
21 .\" Standard, the original IEEE and The Open Group Standard is the referee
22 .\" document. The original Standard can be obtained online at
23 .\" http://www.opengroup.org/unix/online.html.
25 .\" This notice shall appear on any product containing this material.
27 .\" The contents of this file are subject to the terms of the
28 .\" Common Development and Distribution License (the "License").
29 .\" You may not use this file except in compliance with the License.
31 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
32 .\" or http://www.opensolaris.org/os/licensing.
33 .\" See the License for the specific language governing permissions
34 .\" and limitations under the License.
36 .\" When distributing Covered Code, include this CDDL HEADER in each
37 .\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
38 .\" If applicable, add the following below this CDDL HEADER, with the
39 .\" fields enclosed by brackets "[]" replaced with your own identifying
40 .\" information: Portions Copyright [yyyy] [name of copyright owner]
43 .\" Copyright (c) 2001, The IEEE and The Open Group. All Rights Reserved.
44 .\" Portions Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved.
45 .\" Copyright 2016 Joyent, Inc.
47 .TH TIME.H 3HEAD "Feb 5, 2008"
49 time.h, time \- time types
53 #include <\fBtime.h\fR>
58 The <\fBtime.h\fR> header declares the structure \fBtm\fR, which includes the
63 int tm_sec /* seconds [0,60] */
64 int tm_min /* minutes [0,59] */
65 int tm_hour /* hour [0,23] */
66 int tm_mday /* day of month [1,31] */
67 int tm_mon /* month of year [0,11] */
68 int tm_year /* years since 1900 */
69 int tm_wday /* day of week [0,6] (Sunday =0) */
70 int tm_yday /* day of year [0,365] */
71 int tm_isdst /* daylight savings flag */
77 The value of \fBtm_isdst\fR is positive if Daylight Saving Time is in effect, 0
78 if Daylight Saving Time is not in effect, and negative if the information is
82 The <\fBtime.h\fR> header defines the following symbolic names:
89 Null pointer constant.
95 \fB\fBCLOCKS_PER_SEC\fR\fR
98 A number used to convert the value returned by the \fBclock()\fR function into
99 seconds. See \fBclock\fR(3C).
105 \fB\fBCLOCK_PROCESS_CPUTIME_ID\fR\fR
108 The identifier of the CPU-time clock associated with the process making a
109 \fBclock()\fR or \fBtimer*()\fR function call.
115 \fB\fBCLOCK_THREAD_CPUTIME_ID\fR\fR
118 The identifier of the CPU-time clock associated with the thread making a
119 \fBclock()\fR or \fBtimer*()\fR function call.
124 The <\fBtime.h\fR> header declares the \fBtimespec\fR structure, which has the
129 time_t tv_sec /* seconds */
130 long tv_nsec /* nanoseconds */
136 The <\fBtime.h\fR> header declares the \fBitimerspec\fR structure, which has
137 the following members:
141 struct timespec it_interval /* timer period */
142 struct timespec it_value /* timer expiration */
148 The following manifest constants are defined:
152 \fB\fBCLOCK_REALTIME\fR\fR
155 The identifier of the system-wide realtime clock.
161 \fB\fBTIMER_ABSTIME\fR\fR
164 Flag indicating time is absolute. For functions taking timer objects, this
165 refers to the clock associated with the timer.
171 \fB\fBCLOCK_MONOTONIC\fR\fR
174 The identifier for the system-wide monotonic clock, which is defined as a clock
175 whose value cannot be set with \fBclock_settime()\fR and that cannot have
176 backward clock jumps. The maximum possible clock jump is
177 implementation-defined. See \fBclock_settime\fR(3C).
186 The identifier for the system-wide realtime clock with no time zone
187 translation. Used in \fBtimespec_get\fR().
192 The \fBclock_t\fR, \fBsize_t\fR, \fBtime_t\fR, \fBclockid_t\fR, and
193 \fBtimer_t\fR types are defined as described in <\fBsys/types.h\fR>. See
194 \fBtypes.h\fR(3HEAD).
197 Although the value of \fBCLOCKS_PER_SEC\fR is required to be 1 million on all
198 standard-conforming systems, it can be variable on other systems, and it should
199 not be assumed that \fBCLOCKS_PER_SEC\fR is a compile-time constant.
202 The <\fBtime.h\fR> header provides a declaration for \fBgetdate_err\fR.
205 The following are declared as variables:
210 extern long timezone;
211 extern char *tzname[];
217 Inclusion of the <\fBtime.h\fR> header can make visible all symbols from the
218 <\fBsignal.h\fR> header.
221 The range [0,60] for \fBtm_sec\fR allows for the occasional leap second.
224 \fBtm_year\fR is a signed value; therefore, years before 1900 can be
228 To obtain the number of clock ticks per second returned by the \fBtimes()\fR
229 function, applications should call \fBsysconf(_SC_CLK_TCK)\fR. See
230 \fBtimes\fR(2) and \fBsysconf\fR(3C).
233 See \fBattributes\fR(5) for descriptions of the following attributes:
241 ATTRIBUTE TYPE ATTRIBUTE VALUE
243 Interface Stability Committed
245 Standard See \fBstandards\fR(5).
250 \fBtime\fR(2), \fButime\fR(2), \fBclock\fR(3C), \fBctime\fR(3C),
251 \fBdifftime\fR(3C), \fBgetdate\fR(3C), \fBmktime\fR(3C),
252 \fBstrftime\fR(3C), \fBstrptime\fR(3C), \fBtypes.h\fR(3HEAD),
253 \fBclock_settime\fR(3C), \fBnanosleep\fR(3C), \fBtimer_create\fR(3C),
254 \fBtimer_delete\fR(3C), \fBtimer_settime\fR(3C), \fBtimespec_get\fR(3C),
255 \fBattributes\fR(5), \fBstandards\fR(5)