diff options
Diffstat (limited to 'misc.c')
-rw-r--r-- | misc.c | 4 |
1 files changed, 4 insertions, 0 deletions
@@ -857,12 +857,16 @@ ms_to_timeval(struct timeval *tv, int ms) | |||
857 | time_t | 857 | time_t |
858 | monotime(void) | 858 | monotime(void) |
859 | { | 859 | { |
860 | #if defined(HAVE_CLOCK_GETTIME) && defined(CLOCK_MONOTONIC) | ||
860 | struct timespec ts; | 861 | struct timespec ts; |
861 | 862 | ||
862 | if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) | 863 | if (clock_gettime(CLOCK_MONOTONIC, &ts) != 0) |
863 | fatal("clock_gettime: %s", strerror(errno)); | 864 | fatal("clock_gettime: %s", strerror(errno)); |
864 | 865 | ||
865 | return (ts.tv_sec); | 866 | return (ts.tv_sec); |
867 | #else | ||
868 | return time(NULL); | ||
869 | #endif | ||
866 | } | 870 | } |
867 | 871 | ||
868 | void | 872 | void |