I'm compiling some code which requests POSIX 1003.1 1993 conformance via
The code includes the header
<sys/time.h> and wants to call
gettimeofday, but on NetBSD 5.1 there is a compiler warning about that function not being declared.
Looking into NetBSD's header, we see that the declaration of
gettimeofday is wrapped with a test for
_POSIX_C_SOURCE being at least
gettimeofday really only introduced to POSIX in 2001? That hardly seems right. In 1993, there was already
clock_gettime with nanoseconds and different clock types, and
getttimeofday is ancient 4.2 BSD stuff.
In the GNU C library's
gettimeofday is not wrapped by anything at all.
Which is is right: NetBSD header, or my code relying on
_POSIX_C_SOURCE=2 to reveal the declaration of
gettimeofday (and glibc, for providing it unconditionally)?