summaryrefslogtreecommitdiffstats
path: root/man/man3type/tm.3type
blob: 5d5b286587cbba32ee440efe8c2186505a0289f3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
.\" Copyright (c) 2022 by Alejandro Colomar <alx@kernel.org>
.\"
.\" SPDX-License-Identifier: Linux-man-pages-copyleft
.\"
.\"
.TH tm 3type (date) "Linux man-pages (unreleased)"
.SH NAME
tm \- broken-down time
.SH LIBRARY
Standard C library
.RI ( libc )
.SH SYNOPSIS
.EX
.B #include <time.h>
.P
.B struct tm {
.BR "    int         tm_sec;" "    /* Seconds          [" 0 ", " 60 "] */"
.BR "    int         tm_min;" "    /* Minutes          [" 0 ", " 59 "] */"
.BR "    int         tm_hour;" "   /* Hour             [" 0 ", " 23 "] */"
.BR "    int         tm_mday;" "   /* Day of the month [" 1 ", " 31 "] */"
.BR "    int         tm_mon;" \
"    /* Month            [" 0 ", " 11 "]  (January = " 0 ") */"
.BR "    int         tm_year;" "   /* Year minus " 1900 " */"
.BR "    int         tm_wday;" \
"   /* Day of the week  [" 0 ", " 6 "]   (Sunday = " 0 ") */"
.BR "    int         tm_yday;" \
"   /* Day of the year  [" 0 ", " 365 "] (Jan/01 = " 0 ") */"
.BR "    int         tm_isdst;" "  /* Daylight savings flag */"
.P
.BR "    long        tm_gmtoff;" " /* Seconds East of UTC */"
.BR "    const char *tm_zone;" "   /* Timezone abbreviation */"
.B };
.EE
.P
.RS -4
Feature Test Macro Requirements for glibc (see
.BR feature_test_macros (7)):
.RE
.P
.IR tm_gmtoff ,
.IR tm_zone :
.nf
.\" Guarded with __USE_MISC:
    Since glibc 2.20:
        _DEFAULT_SOURCE
    glibc 2.20 and earlier:
        _BSD_SOURCE
.fi
.SH DESCRIPTION
Describes time, broken down into distinct components.
.P
.I tm_isdst
describes whether daylight saving time is in effect at the time described.
The value is positive if daylight saving time is in effect,
zero if it is not,
and negative if the information is not available.
.P
.I tm_gmtoff
is the difference, in seconds,
of the timezone represented by this broken-down time and UTC
(this is the additive inverse of
.BR timezone (3)).
.P
.I tm_zone
is the equivalent of
.BR tzname (3)
for the timezone represented by this broken-down time.
.SH VERSIONS
In C90,
.I tm_sec
could represent values in the range
.RB [ 0 ", " 61 ],
which could represent a double leap second.
UTC doesn't permit double leap seconds,
so it was limited to
.B 60
in C99.
.P
.BR timezone (3),
as a variable, is an XSI extension: some systems provide the V7-compatible
.\" FreeBSD
.BR timezone (3)
function.
The
.I tm_gmtoff
field provides an alternative (with the opposite sign) for those systems.
.P
.I tm_zone
points to static storage and may be overridden on subsequent calls to
.BR localtime (3)
and similar functions (however, this never happens under glibc).
.SH STANDARDS
C11, POSIX.1-2008.
.SH HISTORY
C89, POSIX.1-2001.
.P
.I tm_gmtoff
and
.I tm_zone
originate from 4.3BSD-Tahoe (where
.I tm_zone
is a
.IR "char *" ).
.SH NOTES
.I tm_sec
can represent a leap second with the value
.BR 60 .
.SH SEE ALSO
.BR ctime (3),
.BR strftime (3),
.BR strptime (3),
.BR time (7)