I searched my Linux box and saw this typedef:
typedef __time_t time_t;
But I could not find the __time_t
definition.
Advertisement
Answer
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 standardtime()
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 asigned 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-bittime_t
type are susceptible to the Year 2038 problem.