1time.h(3HEAD) Headers time.h(3HEAD)
2
3
4
6 time.h, time - time types
7
9 #include <time.h>
10
11
13 The <time.h> header declares the structure tm, which includes the fol‐
14 lowing members:
15
16 int tm_sec /* seconds [0,60] */
17 int tm_min /* minutes [0,59] */
18 int tm_hour /* hour [0,23] */
19 int tm_mday /* day of month [1,31] */
20 int tm_mon /* month of year [0,11] */
21 int tm_year /* years since 1900 */
22 int tm_wday /* day of week [0,6] (Sunday =0) */
23 int tm_yday /* day of year [0,365] */
24 int tm_isdst /* daylight savings flag */
25
26
27
28 The value of tm_isdst is positive if Daylight Saving Time is in effect,
29 0 if Daylight Saving Time is not in effect, and negative if the infor‐
30 mation is not available.
31
32
33 The <time.h> header defines the following symbolic names:
34
35 NULL Null pointer constant.
36
37
38 CLOCKS_PER_SEC A number used to convert the value returned
39 by the clock() function into seconds. See
40 clock(3C).
41
42
43 CLOCK_PROCESS_CPUTIME_ID The identifier of the CPU-time clock asso‐
44 ciated with the process making a clock() or
45 timer*() function call.
46
47
48 CLOCK_THREAD_CPUTIME_ID The identifier of the CPU-time clock asso‐
49 ciated with the thread making a clock() or
50 timer*() function call.
51
52
53
54 The <time.h> header declares the timespec structure, which has the fol‐
55 lowing members:
56
57 time_t tv_sec /* seconds */
58 long tv_nsec /* nanoseconds */
59
60
61
62 The <time.h> header declares the itimerspec structure, which has the
63 following members:
64
65 struct timespec it_interval /* timer period */
66 struct timespec it_value /* timer expiration */
67
68
69
70 The following manifest constants are defined:
71
72 CLOCK_REALTIME The identifier of the system-wide realtime clock.
73
74
75 TIMER_ABSTIME Flag indicating time is absolute. For functions tak‐
76 ing timer objects, this refers to the clock associ‐
77 ated with the timer.
78
79
80 CLOCK_MONOTONIC The identifier for the system-wide monotonic clock,
81 which is defined as a clock whose value cannot be
82 set with clock_settime() and that cannot have back‐
83 ward clock jumps. The maximum possible clock jump is
84 implementation-defined. See clock_settime(3C).
85
86
87
88 The clock_t, size_t, time_t, clockid_t, and timer_t types are defined
89 as described in <sys/types.h>. See types.h(3HEAD).
90
91
92 Although the value of CLOCKS_PER_SEC is required to be 1 million on all
93 standard-conforming systems, it can be variable on other systems, and
94 it should not be assumed that CLOCKS_PER_SEC is a compile-time con‐
95 stant.
96
97
98 The <time.h> header provides a declaration for getdate_err.
99
100
101 The following are declared as variables:
102
103 extern int daylight;
104 extern long timezone;
105 extern char *tzname[];
106
107
108
109 Inclusion of the <time.h> header can make visible all symbols from the
110 <signal.h> header.
111
113 The range [0,60] for tm_sec allows for the occasional leap second.
114
115
116 tm_year is a signed value; therefore, years before 1900 can be repre‐
117 sented.
118
119
120 To obtain the number of clock ticks per second returned by the times()
121 function, applications should call sysconf(_SC_CLK_TCK). See times(2)
122 and sysconf(3C).
123
125 See attributes(5) for descriptions of the following attributes:
126
127
128
129
130 ┌─────────────────────────────┬─────────────────────────────┐
131 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
132 ├─────────────────────────────┼─────────────────────────────┤
133 │Interface Stability │Committed │
134 ├─────────────────────────────┼─────────────────────────────┤
135 │Standard │See standards(5). │
136 └─────────────────────────────┴─────────────────────────────┘
137
139 time(2), utime(2), clock(3C), ctime(3C), difftime(3C), getdate(3C),
140 mktime(3C), strftime(3C), strptime(3C), types.h(3HEAD), clock_set‐
141 time(3C), nanosleep(3C), timer_create(3C), timer_delete(3C), timer_set‐
142 time(3C), attributes(5), standards(5)
143
144
145
146SunOS 5.11 5 Feb 2008 time.h(3HEAD)