Next: Locale, Previous: Signals, Up: Top [Contents][Index]

## 8 Time Functions (`time.h`)

This chapter groups functions used either for reporting on time (elapsed, current, or compute time) or to perform calculations based on time.

The header file `time.h` defines three types. `clock_t` and `time_t` are both used for representations of time particularly suitable for arithmetic. (In this implementation, quantities of type `clock_t` have the highest resolution possible on your machine, and quantities of type `time_t` resolve to seconds.) `size_t` is also defined if necessary for quantities representing sizes.

`time.h` also defines the structure `tm` for the traditional representation of Gregorian calendar time as a series of numbers, with the following fields:

`tm_sec`

  Seconds, between 0 and 60 inclusive (60 allows for leap seconds).

`tm_min`

  Minutes, between 0 and 59 inclusive.

`tm_hour`

  Hours, between 0 and 23 inclusive.

`tm_mday`

  Day of the month, between 1 and 31 inclusive.

`tm_mon`

  Month, between 0 (January) and 11 (December).

`tm_year`

  Year (since 1900), can be negative for earlier years.

`tm_wday`

  Day of week, between 0 (Sunday) and 6 (Saturday).

`tm_yday`

  Number of days elapsed since last January 1, between 0 and 365 inclusive.

`tm_isdst`

  Daylight Savings Time flag: positive means DST in effect, zero means DST not in effect, negative means no information about DST is available. Although for mktime(), negative means that it should decide if DST is in effect or not.

Next: Locale, Previous: Signals, Up: Top [Contents][Index]