From e38f094c1683058da32c0afbd82c501be9249951 Mon Sep 17 00:00:00 2001 From: Carter Li Date: Thu, 13 Feb 2025 22:56:25 +0000 Subject: [PATCH] Uptime (Haiku): silence compiler warnings --- src/common/time.h | 6 ++++++ src/detection/uptime/uptime_haiku.c | 6 ++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/common/time.h b/src/common/time.h index 588ba7847..a04120905 100644 --- a/src/common/time.h +++ b/src/common/time.h @@ -7,6 +7,8 @@ #include #include #include +#elif defined(__HAIKU__) + #include #endif static inline double ffTimeGetTick(void) //In msec @@ -17,6 +19,8 @@ static inline double ffTimeGetTick(void) //In msec LARGE_INTEGER start; QueryPerformanceCounter(&start); return (double) start.QuadPart * 1000 / (double) frequency.QuadPart; + #elif defined(__HAIKU__) + return (double) system_time() / 1000.; #else struct timespec timeNow; clock_gettime(CLOCK_MONOTONIC, &timeNow); @@ -30,6 +34,8 @@ static inline uint64_t ffTimeGetNow(void) uint64_t timeNow; GetSystemTimeAsFileTime((FILETIME*) &timeNow); return (timeNow - 116444736000000000ull) / 10000ull; + #elif defined(__HAIKU__) + return (uint64_t) real_time_clock_usecs() / 1000u; #else struct timespec timeNow; clock_gettime(CLOCK_REALTIME, &timeNow); diff --git a/src/detection/uptime/uptime_haiku.c b/src/detection/uptime/uptime_haiku.c index 46af1115e..a2c48a5ec 100644 --- a/src/detection/uptime/uptime_haiku.c +++ b/src/detection/uptime/uptime_haiku.c @@ -1,11 +1,9 @@ #include "uptime.h" #include "common/time.h" -#include - const char* ffDetectUptime(FFUptimeResult* result) { - result->uptime = system_time() / 1000; - result->bootTime = (real_time_clock_usecs() / 1000) - result->uptime; + result->uptime = (uint64_t) system_time() / 1000; + result->bootTime = ffTimeGetNow() - result->uptime; return NULL; }