[libcxx-commits] [PATCH] D79305: chrono: check _POSIX_TIMERS before using clock_gettime

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


LittleFox94 updated this revision to Diff 261930.
LittleFox94 marked 2 inline comments as done.
LittleFox94 added a comment.

Do not include unistd.h on `_WIN32`, re-add `__APPLE__` check and change `_POSIX_TIMER` check to check for `> 0`


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
@@ -12,9 +12,13 @@
 #include <time.h>        // clock_gettime, CLOCK_MONOTONIC and CLOCK_REALTIME
 #include "include/apple_availability.h"
 
-#if !defined(__APPLE__)
+#if !defined(_WIN32)
+#include <unistd.h>
+#endif
+
+#if !defined(__APPLE__) && _POSIX_TIMERS > 0
 #define _LIBCPP_USE_CLOCK_GETTIME
-#endif // __APPLE__
+#endif
 
 #if defined(_LIBCPP_WIN32API)
 #define WIN32_LEAN_AND_MEAN


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79305.261930.patch
Type: text/x-patch
Size: 540 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200504/80b498e0/attachment.bin>


More information about the libcxx-commits mailing list