1.\" 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/. 6.\" 7.\" The Institute of Electrical and Electronics Engineers and The Open 8.\" Group, have given us permission to reprint portions of their 9.\" documentation. 10.\" 11.\" In the following statement, the phrase ``this text'' refers to portions 12.\" of the system documentation. 13.\" 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. 24.\" 25.\" This notice shall appear on any product containing this material. 26.\" 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. 30.\" 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. 35.\" 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] 41.\" 42.\" 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. 46.\" Copyright 2021 Oxide Computer Company 47.\" 48.Dd October 4, 2021 49.Dt TIME.H 3HEAD 50.Os 51.Sh NAME 52.Nm time.h , 53.Nm time 54.Nd time types 55.Sh SYNOPSIS 56.In time.h 57.Sh DESCRIPTION 58The 59.In time.h 60header declares the structure 61.Vt tm , 62which includes the following members: 63.Bd -literal -offset indent 64int tm_sec /* seconds [0,60] */ 65int tm_min /* minutes [0,59] */ 66int tm_hour /* hour [0,23] */ 67int tm_mday /* day of month [1,31] */ 68int tm_mon /* month of year [0,11] */ 69int tm_year /* years since 1900 */ 70int tm_wday /* day of week [0,6] (Sunday =0) */ 71int tm_yday /* day of year [0,365] */ 72int tm_isdst /* daylight savings flag */ 73.Ed 74.Pp 75The value of 76.Fa tm_isdst 77is positive if Daylight Saving Time is in effect, 0 if Daylight Saving 78Time is not in effect, and negative if the information is not available. 79.Pp 80The 81.In time.h 82header defines the following symbolic names: 83.Bl -tag -width Ds 84.It Dv CLOCK_MONOTONIC 85The identifier for the system-wide monotonic clock, which is defined as a clock 86whose value cannot be set with 87.Fn clock_settime 88and that cannot have backward clock jumps. 89The maximum possible clock jump is implementation-defined. 90See 91.Xr clock_settime 3C . 92.It Dv CLOCKS_PER_SEC 93A number used to convert the value returned by the 94.Fn clock 95function into seconds. 96See 97.Xr clock 3C . 98.It Dv CLOCK_PROCESS_CPUTIME_ID 99The identifier of the CPU-time clock associated with the process making a 100.Fn clock 101or 102.Fn timer_* 103function call. 104This clock includes both user and system CPU-time. 105.It Dv CLOCK_REALTIME 106The identifier of the system-wide realtime clock. 107.It Dv CLOCK_THREAD_CPUTIME_ID 108The identifier of the CPU-time clock associated with the thread making a 109.Fn clock 110or 111.Fn timer_* 112function call. 113This clock includes both user and system CPU-time. 114.It Dv CLOCK_VIRTUAL 115The identifier of the CPU-time clock associated with the thread making a 116.Fn clock 117or 118.Fn timer_* 119function call. 120This clock only includes user CPU-time. 121.It Dv NULL 122Null pointer constant. 123.It Dv TIMER_ABSTIME 124Flag indicating time is absolute. 125For functions taking timer objects, this refers to the clock associated 126with the timer. 127.It Dv TIME_UTC 128The identifier for the system-wide realtime clock with no time zone 129translation. 130Used in 131.Fn timespec_get . 132.El 133.Pp 134The 135.In time.h 136header declares the 137.Vt timespec 138structure, which has the following members: 139.Bd -literal -offset indent 140time_t tv_sec /* seconds */ 141long tv_nsec /* nanoseconds */ 142.Ed 143.Pp 144The 145.In time.h 146header declares the 147.Vt itimerspec 148structure, which has the following members: 149.Bd -literal -offset indent 150struct timespec it_interval /* timer period */ 151struct timespec it_value /* timer expiration */ 152.Ed 153.Pp 154The 155.Vt clock_t , 156.Vt size_t , 157.Vt time_t , 158.Vt clockid_t , 159and 160.Vt timer_t 161types are defined as described in 162.In sys/types.h . 163See 164.Xr types.h 3HEAD . 165.Pp 166Although the value of 167.Dv CLOCKS_PER_SEC 168is required to be 1 million on all standard-conforming systems, it can 169be variable on other systems, and it should not be assumed that 170.Dv CLOCKS_PER_SEC 171is a compile-time constant. 172.Pp 173The 174.In time.h 175header provides a declaration for 176.Dv getdate_err . 177.Pp 178The following are declared as variables: 179.Bd -literal -offset indent 180extern int daylight; 181extern long timezone; 182extern char *tzname[]; 183.Ed 184.Pp 185Inclusion of the 186.In time.h 187header can make visible all symbols from the 188.In signal.h 189header. 190.Sh USAGE 191The range [0,60] for 192.Fa tm_sec 193allows for the occasional leap second. 194.Pp 195.Fa tm_year 196is a signed value; therefore, years before 1900 can be represented. 197.Pp 198To obtain the number of clock ticks per second returned by the 199.Fn times 200function, applications should call 201.Fn sysconf "_SC_CLK_TCK" . 202See 203.Xr times 2 204and 205.Xr sysconf 3C . 206.Sh INTERFACE STABILITY 207.Sy Committed 208.Sh SEE ALSO 209.Xr time 2 , 210.Xr utime 2 , 211.Xr clock 3C , 212.Xr clock_settime 3C , 213.Xr ctime 3C , 214.Xr difftime 3C , 215.Xr getdate 3C , 216.Xr mktime 3C , 217.Xr nanosleep 3C , 218.Xr strftime 3C , 219.Xr strptime 3C , 220.Xr timer_create 3C , 221.Xr timer_delete 3C , 222.Xr timer_settime 3C , 223.Xr timespec_get 3C , 224.Xr types.h 3HEAD , 225.Xr attributes 7 , 226.Xr standards 7 227