TM(3)

TM(3) | Library Functions Manual | TM(3)

# NAME

tm — time structure

# SYNOPSIS

#include <time.h>

# DESCRIPTION

The <time.h> header defines the tm structure that contains calendar dates and time broken down into components. The following standards-compliant fields are present:

Type | Field | Represents | Range
int | tm_sec | Seconds | [0, 61]
int | tm_min | Minutes | [0, 59]
int | tm_hour | Hours since midnight | [0, 23]
int | tm_mday | Day of the month | [1, 31]
int | tm_mon | Months since January | [0, 11]
int | tm_year | Years since 1900 |
int | tm_wday | Days since Sunday | [0, 6]
int | tm_yday | Days since January 1 | [0, 365]
int | tm_isdt | Positive if daylight savings | >= 0

The tm structure is used by various common library routines such as mktime(3), localtime(3), and strptime(3). All fields described above are defined in the IEEE Std 1003.1-2008 (“POSIX.1”) standard.

## NetBSD Extensions

In addition, the following NetBSD-specific fields are available:

Type | Field | Represents
int | tm_gmtoff | Offset from UTC in seconds
__aconst char | tm_zone | Timezone abbreviation

The tm_zone and tm_gmtoff fields exist, and are filled in by applicable library routines, only if arrangements to do so were made when the library containing these functions was created. There is no guarantee that these fields will continue to exist in this form in future releases of NetBSD.
The tm_gmtoff field denotes the offset (in seconds) of the time represented from UTC, with positive values indicating east of the Prime Meridian. The tm_zone field will become invalid and point to freed storage if the corresponding struct tm was returned by localtime_rz(3) and the const timezone_t tz argument has been freed by tzfree(3).

# SEE ALSO

asctime(3), offtime(3), timeval(3), wcsftime(3)

# STANDARDS

The tm structure conforms to IEEE Std 1003.1-2008 (“POSIX.1”) with respect to the described standard structure members.

April 14, 2011 | NetBSD 8.0