What is time_t ultimately a typedef to?

The time_t Wikipedia article article sheds some light on this. The bottom line is that the type of time_t is not guaranteed in the C specification.

The time_t datatype is a data type in
the ISO C library defined for storing
system time values. Such values are
returned from the standard time()
library function. This type is a
typedef defined in the standard
header. ISO C defines
time_t as an arithmetic type, but does
not specify any particular type
,
range, resolution, or encoding for it.
Also unspecified are the meanings of
arithmetic operations applied to time
values.

Unix and POSIX-compliant systems implement the time_t type as a signed
integer
(typically 32 or 64 bits wide)
which represents the number of seconds
since the start of the Unix epoch
:
midnight UTC of January 1, 1970 (not
counting leap seconds). Some systems
correctly handle negative time values,
while others do not. Systems using a
32-bit time_t type are susceptible to
the Year 2038 problem.

Leave a Comment