[libc++] chrono: check _POSIX_TIMERS before using clock_gettime

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

Differential Revision: https://reviews.llvm.org/D79305
This commit is contained in:
Mara Sophie Grosch 2020-05-07 12:10:33 -04:00 committed by Louis Dionne
parent 34a57dc972
commit 59b3102739
2 changed files with 11 additions and 3 deletions

View File

@ -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

View File

@ -36,7 +36,11 @@
#define _LIBCPP_USE_COPYFILE
#endif
#if !defined(__APPLE__)
#if !defined(_WIN32)
#include <unistd.h>
#endif
#if !defined(__APPLE__) && _POSIX_TIMERS > 0
#define _LIBCPP_USE_CLOCK_GETTIME
#endif