You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.8 KiB
62 lines
1.8 KiB
Index: src/buffer.c |
|
--- src/buffer.c.orig 2019-09-22 13:16:22.000000000 +0200 |
|
+++ src/buffer.c 2019-09-23 21:12:22.277103000 +0200 |
|
@@ -1,3 +1,4 @@ |
|
+#include <sys/types.h> |
|
#include "buffer.h" |
|
#include "rmalloc.h" |
|
#include <assert.h> |
|
Index: src/buffer.h |
|
--- src/buffer.h.orig 2019-09-22 13:16:22.000000000 +0200 |
|
+++ src/buffer.h 2019-09-23 21:12:22.277227000 +0200 |
|
@@ -6,6 +6,8 @@ |
|
#include <string.h> |
|
#include <stdint.h> |
|
#include <arpa/inet.h> |
|
+#include <sys/types.h> |
|
+#include <inttypes.h> |
|
|
|
#define BUFFER_READ 0 |
|
#define BUFFER_WRITE 1 |
|
Index: src/concurrent_ctx.c |
|
--- src/concurrent_ctx.c.orig 2019-09-22 13:16:22.000000000 +0200 |
|
+++ src/concurrent_ctx.c 2019-09-23 21:12:22.277363000 +0200 |
|
@@ -137,7 +137,11 @@ |
|
/** Check the elapsed timer, and release the lock if enough time has passed */ |
|
int ConcurrentSearch_CheckTimer(ConcurrentSearchCtx *ctx) { |
|
static struct timespec now; |
|
+#ifdef CLOCK_MONOTONIC_RAW |
|
clock_gettime(CLOCK_MONOTONIC_RAW, &now); |
|
+#else |
|
+ clock_gettime(CLOCK_MONOTONIC, &now); |
|
+#endif |
|
|
|
long long durationNS = (long long)1000000000 * (now.tv_sec - ctx->lastTime.tv_sec) + |
|
(now.tv_nsec - ctx->lastTime.tv_nsec); |
|
@@ -159,7 +163,11 @@ |
|
} |
|
|
|
void ConcurrentSearchCtx_ResetClock(ConcurrentSearchCtx *ctx) { |
|
+#ifdef CLOCK_MONOTONIC_RAW |
|
clock_gettime(CLOCK_MONOTONIC_RAW, &ctx->lastTime); |
|
+#else |
|
+ clock_gettime(CLOCK_MONOTONIC, &ctx->lastTime); |
|
+#endif |
|
ctx->ticker = 0; |
|
} |
|
|
|
Index: src/cursor.c |
|
--- src/cursor.c.orig 2019-09-22 13:16:22.000000000 +0200 |
|
+++ src/cursor.c 2019-09-23 21:12:22.277489000 +0200 |
|
@@ -8,7 +8,11 @@ |
|
|
|
static uint64_t curTimeNs() { |
|
struct timespec tv; |
|
+#ifdef CLOCK_MONOTONIC_RAW |
|
+ clock_gettime(CLOCK_MONOTONIC_RAW, &tv); |
|
+#else |
|
clock_gettime(CLOCK_MONOTONIC, &tv); |
|
+#endif |
|
return tv.tv_nsec + (tv.tv_sec * 1000000000); |
|
} |
|
|
|
|