1tm(3type)                                                            tm(3type)
2
3
4

NAME

6       tm - broken-down time
7

LIBRARY

9       Standard C library (libc)
10

SYNOPSIS

12       #include <time.h>
13
14       struct tm {
15           int         tm_sec;    /* Seconds          [0, 60] */
16           int         tm_min;    /* Minutes          [0, 59] */
17           int         tm_hour;   /* Hour             [0, 23] */
18           int         tm_mday;   /* Day of the month [1, 31] */
19           int         tm_mon;    /* Month            [0, 11]  (January = 0) */
20           int         tm_year;   /* Year minus 1900 */
21           int         tm_wday;   /* Day of the week  [0, 6]   (Sunday = 0) */
22           int         tm_yday;   /* Day of the year  [0, 365] (Jan/01 = 0) */
23           int         tm_isdst;  /* Daylight savings flag */
24
25           long        tm_gmtoff; /* Seconds East of UTC */
26           const char *tm_zone;   /* Timezone abbreviation */
27       };
28
29   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
30
31       tm_gmtoff, tm_zone:
32           Since glibc 2.20:
33               _DEFAULT_SOURCE
34           glibc 2.20 and earlier:
35               _BSD_SOURCE
36

DESCRIPTION

38       Describes time, broken down into distinct components.
39
40       tm_isdst  describes  whether  daylight  saving time is in effect at the
41       time described.  The value is positive if daylight saving  time  is  in
42       effect,  zero  if  it  is  not,  and negative if the information is not
43       available.
44
45       tm_gmtoff is the difference, in seconds, of the timezone represented by
46       this  broken-down  time  and UTC (this is the additive inverse of time‐
47       zone(3)).
48
49       tm_zone is the equivalent of tzname(3) for the timezone represented  by
50       this broken-down time.
51

VERSIONS

53       In C90, tm_sec could represent values in the range [0, 61], which could
54       represent a double leap second.  UTC doesn't permit  double  leap  sec‐
55       onds, so it was limited to 60 in C99.
56
57       timezone(3),  as  a variable, is an XSI extension: some systems provide
58       the V7-compatible timezone(3) function.  The tm_gmtoff  field  provides
59       an alternative (with the opposite sign) for those systems.
60
61       tm_zone  points  to  static storage and may be overridden on subsequent
62       calls to localtime(3) and similar functions (however, this  never  hap‐
63       pens under glibc).
64

STANDARDS

66       C11, POSIX.1-2008.
67

HISTORY

69       C89, POSIX.1-2001.
70
71       tm_gmtoff  and  tm_zone originate from 4.3BSD-Tahoe (where tm_zone is a
72       char *).
73

NOTES

75       tm_sec can represent a leap second with the value 60.
76

SEE ALSO

78       ctime(3), strftime(3), strptime(3), time(7)
79
80
81
82Linux man-pages 6.04              2023-03-30                         tm(3type)
Impressum