summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLutz Mader <lutz.mader@freenet.de>2021-11-19 22:24:47 +0100
committerBenBE <BenBE@geshi.org>2021-11-28 23:13:46 +0100
commit171aa0faaa8846409cd731abe61575aed52d8975 (patch)
tree62da2fe6f69333c065b3b15051076453d52a7799
parentddfacb8694b1c7824e87c33ccab419f55c63e5ae (diff)
Add a fix to use gettimeofday if monotonic is not available.
-rw-r--r--generic/gettime.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/generic/gettime.c b/generic/gettime.c
index 975457fe..b7c4885e 100644
--- a/generic/gettime.c
+++ b/generic/gettime.c
@@ -49,9 +49,13 @@ void Generic_gettime_monotonic(uint64_t* msec) {
else
*msec = 0;
-#else
+#else /* lower resolution gettimeofday() should be always available */
-# error "No monotonic clock available"
+ struct timeval tv;
+ if (gettimeofday(&tv, NULL) == 0)
+ *msec = ((uint64_t)tv.tv_sec * 1000) + ((uint64_t)tv.tv_usec / 1000);
+ else
+ *msec = 0;
#endif
}

© 2014-2022 Faster IT GmbH | imprint | privacy policy