]> git.ipfire.org Git - thirdparty/nqptp.git/commitdiff
Add CLOCK_MONOTONIC as an alternative is CLOCK_MONOTONIC_RAW isn't available, as...
authorMike Brady <4265913+mikebrady@users.noreply.github.com>
Thu, 19 May 2022 19:29:36 +0000 (20:29 +0100)
committerMike Brady <4265913+mikebrady@users.noreply.github.com>
Thu, 19 May 2022 19:29:36 +0000 (20:29 +0100)
general-utilities.c

index 6af29774c410e5a106c994ed63ecf609f1892923..b758c773e93f0d0f0d18fb64e5ec43d8f1d079e7 100644 (file)
@@ -66,6 +66,10 @@ uint64_t timespec_to_ns(struct timespec *tn) {
 
 uint64_t get_time_now() {
   struct timespec tn;
+#ifdef CLOCK_MONOTONIC_RAW
   clock_gettime(CLOCK_MONOTONIC_RAW, &tn);
+#else
+  clock_gettime(CLOCK_MONOTONIC, &tn);
+#endif  
   return timespec_to_ns(&tn);
 }