diff options
author | Vincent Sanders <vince@kyllikki.org> | 2014-11-27 09:17:21 +0000 |
---|---|---|
committer | Vincent Sanders <vince@kyllikki.org> | 2014-11-27 09:17:21 +0000 |
commit | 223480e55ed098cb5f6001f9f49e73b191586e18 (patch) | |
tree | a563442fe9c6d357b4cbb828566e353cf8a0ec3e /src/time.c | |
parent | 0f0358f2856e594fbbd0d3eed9725d1017cd120f (diff) | |
download | libnsutils-223480e55ed098cb5f6001f9f49e73b191586e18.tar.gz libnsutils-223480e55ed098cb5f6001f9f49e73b191586e18.tar.bz2 |
fix include position
Diffstat (limited to 'src/time.c')
-rw-r--r-- | src/time.c | 12 |
1 files changed, 8 insertions, 4 deletions
@@ -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; |