summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Sanders <vince@kyllikki.org>2014-11-27 09:17:21 (GMT)
committer Vincent Sanders <vince@kyllikki.org>2014-11-27 09:17:21 (GMT)
commit223480e55ed098cb5f6001f9f49e73b191586e18 (patch)
treea563442fe9c6d357b4cbb828566e353cf8a0ec3e
parent0f0358f2856e594fbbd0d3eed9725d1017cd120f (diff)
downloadlibnsutils-223480e55ed098cb5f6001f9f49e73b191586e18.tar.gz
libnsutils-223480e55ed098cb5f6001f9f49e73b191586e18.tar.bz2
fix include position
-rw-r--r--src/time.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/time.c b/src/time.c
index 1753ad4..7beef48 100644
--- a/src/time.c
+++ b/src/time.c
@@ -16,6 +16,13 @@
#include <stdlib.h>
#include <unistd.h>
+#if defined(_POSIX_TIMERS) && (_POSIX_TIMERS > 0) && (defined _POSIX_MONOTONIC_CLOCK)
+#include <time.h>
+#elif defined(__riscos)
+#include <oslib/os.h>
+#else
+#include <sys/time.h>
+#endif
#include "nsutils/time.h"
/* exported interface documented in nsutils/time.h */
@@ -25,20 +32,17 @@ nsuerror nsu_getmonotonic_ms(uint64_t *current_out)
static uint64_t prev = 0; /* previous time so we never go backwards */
#if defined(_POSIX_TIMERS) && (_POSIX_TIMERS > 0) && (defined _POSIX_MONOTONIC_CLOCK)
-#include <time.h>
struct timespec tp;
clock_gettime(CLOCK_MONOTONIC, &tp);
current = (tp.tv_sec * 1000) + (tp.tv_nsec / 1000000);
-#elif defined(riscos)
-#include "oslib/os.h"
+#elif defined(__riscos)
os_t time;
time = os_read_monotonic_time();
current = time * 10;
#else
#warning "Using dodgy gettimeofday() fallback"
-#include <sys/time.h>
/** \todo Implement this properly! */
struct timeval tv;