From: Mike Brady <4265913+mikebrady@users.noreply.github.com> Date: Thu, 19 May 2022 19:29:36 +0000 (+0100) Subject: Add CLOCK_MONOTONIC as an alternative is CLOCK_MONOTONIC_RAW isn't available, as... X-Git-Tag: 1.2~39 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8ee0dcbad5ccbe14642dad41a56d18eccbef4ba8;p=thirdparty%2Fnqptp.git Add CLOCK_MONOTONIC as an alternative is CLOCK_MONOTONIC_RAW isn't available, as in FreeBSD. --- diff --git a/general-utilities.c b/general-utilities.c index 6af2977..b758c77 100644 --- a/general-utilities.c +++ b/general-utilities.c @@ -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); }