aboutsummaryrefslogtreecommitdiffstats
path: root/Compat.c
diff options
context:
space:
mode:
authorDaniel Lange <DLange@git.local>2021-01-11 20:43:28 +0100
committerDaniel Lange <DLange@git.local>2021-01-11 20:43:28 +0100
commit94123a215ba971baf4ad7e12cc479258ddb8600e (patch)
tree6f053d8e1ce754ab7104b7364be9754231ab84de /Compat.c
parent50cb99f0acecb15992f3d5610c02676a6c94f2a4 (diff)
parentc55320e9e2a8916e911bcd39ab37b79e3a7d03b2 (diff)
downloaddebian_htop-94123a215ba971baf4ad7e12cc479258ddb8600e.tar.gz
debian_htop-94123a215ba971baf4ad7e12cc479258ddb8600e.tar.bz2
debian_htop-94123a215ba971baf4ad7e12cc479258ddb8600e.zip
Update upstream source from tag 'upstream/3.0.5'
Update to upstream version '3.0.5' with Debian dir 10922042e094a59dc72f9c39ddd4bfd59c7a302c
Diffstat (limited to 'Compat.c')
-rw-r--r--Compat.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/Compat.c b/Compat.c
index 43d02ec..55be1b1 100644
--- a/Compat.c
+++ b/Compat.c
@@ -11,12 +11,18 @@ in the source distribution for its full text.
#include <errno.h>
#include <fcntl.h> // IWYU pragma: keep
+#include <time.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h> // IWYU pragma: keep
#include "XUtils.h" // IWYU pragma: keep
+#ifdef HAVE_HOST_GET_CLOCK_SERVICE
+#include <mach/clock.h>
+#include <mach/mach.h>
+#endif
+
int Compat_faccessat(int dirfd,
const char* pathname,
@@ -117,3 +123,31 @@ ssize_t Compat_readlinkat(int dirfd,
#endif
}
+
+int Compat_clock_monotonic_gettime(struct timespec *tp) {
+
+#if defined(HAVE_CLOCK_GETTIME)
+
+ return clock_gettime(CLOCK_MONOTONIC, tp);
+
+#elif defined(HAVE_HOST_GET_CLOCK_SERVICE)
+
+ clock_serv_t cclock;
+ mach_timespec_t mts;
+
+ host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &cclock);
+ clock_get_time(cclock, &mts);
+ mach_port_deallocate(mach_task_self(), cclock);
+
+ tp->tv_sec = mts.tv_sec;
+ tp->tv_nsec = mts.tv_nsec;
+
+ return 0;
+
+#else
+
+#error No Compat_clock_monotonic_gettime() implementation!
+
+#endif
+
+}

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