tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: struct timezone and _XOPEN_SOURCE



In article <20090702112255.45b75218%behemoth.xisop@localhost>,
Matthew Mondor  <mm_lists%pulsar-zone.net@localhost> wrote:
>Hello,
>
>I have encountered some software declaring _XOPEN_SOURCE == 600 (which
>goal was to be able to use non *_NP pthread macros on Linux, it
>seems).  As a side effect, this code fails to build on netbsd-5 because
>in <sys/times.h> timezone is only defined if _NETBSD_SOURCE yet in
><sys/featuretest.h> _NETBSD_SOURCE is of course only defined if
>_XOPEN_SOURCE is not.
>
>Although the timezone for gettimeofday(2) is deprecated, said software
>uses a dummy tz object.
>
>Anyone know if this should be considered to be a bug in <sys/time.h>
>where timezone should be outside the _NETBSD_SOURCE conditional, or if
>defining _XOPEN_SOURCE == 600 and using gettimeofday(2) is flawed?

The application is flawed:

http://www.opengroup.org/onlinepubs/000095399/functions/gettimeofday.html

It should just pass NULL. Or switch to using clock_gettime() to get better
resolution.

christos



Home | Main Index | Thread Index | Old Index