The type time_t
is specified as an "arithmetic type capable of representing times." However, how time is encoded within this arithmetic type by the function time()
is unspecified. See unspecified behavior 43 in section J.1 of C99. Because the encoding is unspecified, there is no safe way to manually perform arithmetic on the type, and, as a result, the values should not be modified directly.
Note that POSIX ® specifies that the time()
function must return a value of type time_t
representing time in seconds since the Epoch. Thus, POSIX-conforming applications that aren't intended to be portable to other environments may safely perform arithmetic operations on time_t
objects.
Noncompliant Code Example
...