[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 08:32:40 PDT 2020


LittleFox94 updated this revision to Diff 261827.
LittleFox94 added a comment.

Included unistd.h and removed the check for `__APPLE__`, since `_POSIX_TIMERS` should work there, too


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

https://reviews.llvm.org/D79305

Files:
  libcxx/src/chrono.cpp


Index: libcxx/src/chrono.cpp
===================================================================
--- libcxx/src/chrono.cpp
+++ libcxx/src/chrono.cpp
@@ -10,11 +10,12 @@
 #include "cerrno"        // errno
 #include "system_error"  // __throw_system_error
 #include <time.h>        // clock_gettime, CLOCK_MONOTONIC and CLOCK_REALTIME
+#include <unistd.h>
 #include "include/apple_availability.h"
 
-#if !defined(__APPLE__)
+#if _POSIX_TIMERS > 0
 #define _LIBCPP_USE_CLOCK_GETTIME
-#endif // __APPLE__
+#endif // _POSIX_TIMERS
 
 #if defined(_LIBCPP_WIN32API)
 #define WIN32_LEAN_AND_MEAN


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79305.261827.patch
Type: text/x-patch
Size: 588 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200504/8bf5ef87/attachment.bin>


More information about the llvm-commits mailing list