summaryrefslogtreecommitdiff
path: root/misc.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2013-06-02 08:18:31 +1000
committerDarren Tucker <dtucker@zip.com.au>2013-06-02 08:18:31 +1000
commita710891659202c82545e84725d4e5cd77aef567c (patch)
treeedf409cfaafe861f0b208882481c2bf9f583008a /misc.c
parentf60845fde29cead9d75e812db1c04916b4c58ffd (diff)
- (dtucker) [configure.ac misc.c] Look for clock_gettime in librt and fall
back to time(NULL) if we can't find it anywhere.
Diffstat (limited to 'misc.c')
-rw-r--r--misc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/misc.c b/misc.c
index cd45e9ecc..fd745444e 100644
--- a/misc.c
+++ b/misc.c
@@ -857,12 +857,16 @@ ms_to_timeval(struct timeval *tv, int ms)
857time_t 857time_t
858monotime(void) 858monotime(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
868void 872void