blob: 64f2ccf4b856ff655769b05b1a74801157cb338d (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
- CLOCK_MONOTONIC_RAW is not available on FreeBSD
--- src/Rack/src/system.cpp.orig 2025-06-22 11:39:38 UTC
+++ src/Rack/src/system.cpp
@@ -770,7 +770,11 @@ static void initTime() {
#endif
#if defined ARCH_LIN
struct timespec ts;
+#ifdef __FreeBSD__
+ clock_gettime(CLOCK_MONOTONIC_PRECISE, &ts);
+#else
clock_gettime(CLOCK_MONOTONIC_RAW, &ts);
+#endif
startTime = int64_t(ts.tv_sec) * 1000000000LL + ts.tv_nsec;
#endif
#if defined ARCH_MAC
@@ -790,7 +794,11 @@ double getTime() {
return (counter.QuadPart - startCounter) * counterTime;
#elif defined ARCH_LIN
struct timespec ts;
+#ifdef __FreeBSD__
+ clock_gettime(CLOCK_MONOTONIC_PRECISE, &ts);
+#else
clock_gettime(CLOCK_MONOTONIC_RAW, &ts);
+#endif
int64_t time = int64_t(ts.tv_sec) * 1000000000LL + ts.tv_nsec;
return (time - startTime) / 1e9;
#elif defined ARCH_MAC
|