[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
Sun May 3 11:09:33 PDT 2020


LittleFox94 created this revision.
LittleFox94 added projects: LLVM, libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

clock_gettime is documented to be available when _POSIX_TIMERS is defined. Add a check for this


Repository:
  rG LLVM Github Monorepo

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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D79305.261708.patch
Type: text/x-patch
Size: 522 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20200503/a8a13c78/attachment.bin>


More information about the libcxx-commits mailing list