Fix: time constants already defined on macOS
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 6 Sep 2019 17:33:18 +0000 (13:33 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 6 Sep 2019 17:41:06 +0000 (13:41 -0400)
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 <jeremie.galarneau@efficios.com>
src/common/compat/time.h
src/common/time.h

index 49f5039084a79083c63eab538d1486aeeedd594a..593a92ab074f410b2e55ac14dfb93706818e9a0b 100644 (file)
@@ -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__ */
 
index 60d0a9bd5dcd8aa7faa56e8577d2e1f2e381ce0f..4cfdf856c521d155fe55dd7580d5180605097119 100644 (file)
 #include <time.h>
 #include <stdbool.h>
 #include <common/macros.h>
+#include <common/compat/time.h>
 
 #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
This page took 0.027494 seconds and 4 git commands to generate.