The posixoptions manpage shows that the following macros can be used to determine the degree of a host's support for the posix timers API:
_POSIX_TIMERS
_POSIX_CPUTIME
_POSIX_THREAD_CPUTIME
_POSIX_CLOCK_SELECTION
_POSIX_MONOTONIC_CLOCK
On my dev system (Ubuntu-based Linux distro, using gcc 7.5.0), _POSIX_TIMERS
evaluates to 200809
, _POSIX_CPUTIME
to 0
, and _POSIX_THREAD_CPUTIME
to 0
.
I have been searching for more information on these macros, but can't seem to find the needed information. I would like to know where they are defined (in a header file? or "magically" by the compiler?), and what the possible values of _POSIX_TIMERS
are.
However, I did run across some C code which compared _POSIX_TIMERS
to another constant starting with 2012
. So obviously various different values must be possible.
The POSIX definition (2018 edition) says that:
_POSIX_TIMERS
The implementation supports timers. This symbol shall always be set to the value
200809L
.
It's defined in the <unistd.h>
header.