Next: trace.h, Previous: threads.h, Up: ISO C and POSIX Header File Substitutes [Contents][Index]
POSIX specification:
https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/time.h.html
Gnulib module: time-h
Portability problems fixed by Gnulib:
TIME_UTC
is not defined on many platforms:
glibc 2.15, macOS 10.13, FreeBSD 11.0, NetBSD 7.1, OpenBSD 6.0, Minix 3.1.8, AIX 7.1, HP-UX 11.31, Solaris 11.3, Cygwin 2.9, mingw, MSVC 14, Android 9.0.
NULL
macro that cannot be used in arbitrary
expressions:
NetBSD 5.0.
Portability problems fixed by the Gnulib module year2038
:
time_t
defaults to 32-bit but can be
changed to 64-bit, functions like stat
can fail with
errno == EOVERFLOW
when a 32-bit timestamp is out of range,
such as with a file timestamp in the far future or past:
glibc 2.34+ atop 32-bit x86 or ARM Linux.
See Avoiding the year 2038 problem.
Portability problems not fixed by Gnulib:
struct tm
lacks the the tm_gmtoff
and
tm_zone
members:
AIX 7.3, HP-UX 11, Solaris 11.4, mingw, MSVC 14.
daylight
,
timezone
and tzname
are not available. Even on
platforms where they are available, their contents are often unreliable,
even in single-threaded programs.
Portable code can instead use struct tm
’s tm_gmtoff
and
tm_zone
members when available, and the strftime
function
with %z
or %Z
conversion specifiers otherwise.
time_t
is always 32-bit, functions like
stat
can fail with errno == EOVERFLOW
when a timestamp
is out of range, such as with a file timestamp in the far future or
past; on other such platforms,
the functions silently return the low-order 32 bits of the correct
timestamp. These platforms will be obsolete when 32-bit time_t
rolls around, which will occur in 2038 for the typical case when
time_t
is signed.
See Avoiding the year 2038 problem.
tv_nsec
member of struct timespec
is not of type long
, but is of type long long
instead:
glibc x32
Next: trace.h, Previous: threads.h, Up: ISO C and POSIX Header File Substitutes [Contents][Index]