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