From efef32e9dabe51901ea2a0d1f19c69a9c37997eb Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Fri, 6 Sep 2019 13:33:18 -0400 Subject: [PATCH] Fix: time constants already defined on macOS MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Include the compatibility time.h header in the common/time.h to override any platform-defined constants. It seems that the NSEC_PER_SEC (and other similar definitions) are defined to nothing on macOS. This was already fixed in the compatibility header in the past. This also adds USEC_PER_SEC to the list of undef-initions on macOS. Signed-off-by: Jérémie Galarneau --- src/common/compat/time.h | 1 + src/common/time.h | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/compat/time.h b/src/common/compat/time.h index 49f503908..593a92ab0 100644 --- a/src/common/compat/time.h +++ b/src/common/compat/time.h @@ -36,6 +36,7 @@ typedef uint64_t timer_t; #undef NSEC_PER_SEC #undef NSEC_PER_MSEC #undef NSEC_PER_USEC +#undef USEC_PER_SEC #endif /* __APPLE__ */ diff --git a/src/common/time.h b/src/common/time.h index 60d0a9bd5..4cfdf856c 100644 --- a/src/common/time.h +++ b/src/common/time.h @@ -22,14 +22,13 @@ #include #include #include +#include #define MSEC_PER_SEC 1000ULL #define NSEC_PER_SEC 1000000000ULL #define NSEC_PER_MSEC 1000000ULL #define NSEC_PER_USEC 1000ULL -#ifndef USEC_PER_SEC #define USEC_PER_SEC 1000000ULL -#endif #define USEC_PER_MSEC 1000ULL #define SEC_PER_MINUTE 60ULL -- 2.34.1