Skip to content

Commit 523b06d

Browse files
authored
timer: proper way to check POSIX timers support (#136)
The _POSIX_TIMERS macros can be used to determine the degree of a host's support for the posix timers API. 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. Tested on esp32, pico and teensy4. Signed-off-by: Thomas Chou <thomas@wytron.com.tw>
1 parent 48096f8 commit 523b06d

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎platform_code/arduino/clock_gettime.cpp‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include <sys/time.h>
44
#define micro_rollover_useconds 4294967295
55

6-
#ifndef WITH_POSIX
6+
#ifndef _POSIX_TIMERS
77

88
extern "C" int clock_gettime(clockid_t unused, struct timespec *tp)
99
{
@@ -22,4 +22,4 @@ extern "C" int clock_gettime(clockid_t unused, struct timespec *tp)
2222
return 0;
2323
}
2424

25-
#endif // ifndef WITH_POSIX
25+
#endif // ifndef _POSIX_TIMERS

0 commit comments

Comments
 (0)