[PATCH] D79305: chrono: check _POSIX_TIMERS before using clock_gettime

Mara Sophie Grosch via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 4 14:32:26 PDT 2020


LittleFox94 marked 3 inline comments as done.
LittleFox94 added inline comments.


================
Comment at: libcxx/src/chrono.cpp:16
 
-#if !defined(__APPLE__)
+#if _POSIX_TIMERS > 0
 #define _LIBCPP_USE_CLOCK_GETTIME
----------------
ldionne wrote:
> It turns out the `__APPLE__` check is still required. See `libcxx/src/include/apple_availability.h:33` & friends. Thus, I would use:
> 
> ```
> #if !defined(__APPLE__) && defined(_POSIX_TIMERS)
> ```
I extend the check with _POSIX_TIMERS > 0, I have seen a `#define _POSIX_TIMERS (-1)` in a apple unistd.h and doc says `the symbol _POSIX_TIMERS is defined in <unistd.h> to a value greater than 0`


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D79305/new/

https://reviews.llvm.org/D79305





More information about the llvm-commits mailing list