libreplace: make a define for a best effort monotonic clock
authorBjörn Jacke <bj@sernet.de>
Thu, 26 Aug 2010 10:22:02 +0000 (12:22 +0200)
committerBjörn Jacke <bj@sernet.de>
Tue, 31 Aug 2010 08:24:37 +0000 (10:24 +0200)
lib/replace/system/time.h

index ff26531e45b8d4b179056e659799f8ceb25227e4..3605d2692e85a10dc53714be19e7966a982cb91e 100644 (file)
@@ -67,9 +67,16 @@ int rep_utimes(const char *filename, const struct timeval tv[2]);
 #endif
 
 #ifndef HAVE_CLOCK_GETTIME
+/* CLOCK_REALTIME is required by POSIX */
 #define CLOCK_REALTIME 0
 typedef int clockid_t;
 int rep_clock_gettime(clockid_t clk_id, struct timespec *tp);
 #endif
+/* make sure we have a best effort CUSTOM_CLOCK_MONOTONIC we can rely on */
+#ifndef CLOCK_MONOTONIC
+#define CUSTOM_CLOCK_MONOTONIC CLOCK_REALTIME
+#else
+#define CUSTOM_CLOCK_MONOTONIC CLOCK_MONOTONIC
+#endif
 
 #endif