From 09aa60628169fe80305bb64caa9f73968befc414 Mon Sep 17 00:00:00 2001 From: nick black Date: Fri, 27 Dec 2019 01:50:44 -0500 Subject: [PATCH] FreeBSD: no CLOCK_MONOTONIC_RAW #196 --- src/demo/boxdemo.c | 4 ++-- src/lib/internal.h | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/demo/boxdemo.c b/src/demo/boxdemo.c index abfa61937..af1a40ae9 100644 --- a/src/demo/boxdemo.c +++ b/src/demo/boxdemo.c @@ -17,7 +17,7 @@ int box_demo(struct notcurses* nc){ return -1; } struct timespec start, now; - clock_gettime(CLOCK_MONOTONIC_RAW, &start); + clock_gettime(CLOCK_MONOTONIC, &start); int zbonus = 40; int zbonusdelta = 20; int ylen, xlen; @@ -86,7 +86,7 @@ int box_demo(struct notcurses* nc){ return -1; } nanosleep(&iterdelay, NULL); - clock_gettime(CLOCK_MONOTONIC_RAW, &now); + clock_gettime(CLOCK_MONOTONIC, &now); if((zbonus += zbonusdelta > 255) || zbonus < 0){ zbonusdelta = -zbonusdelta; zbonus += zbonusdelta; diff --git a/src/lib/internal.h b/src/lib/internal.h index 6f13d50cc..709a575c5 100644 --- a/src/lib/internal.h +++ b/src/lib/internal.h @@ -2,6 +2,7 @@ #define NOTCURSES_INTERNAL #include +#include #include #include #include @@ -263,6 +264,11 @@ cell* ncplane_cell_ref_yx(ncplane* n, int y, int x); #define NANOSECS_IN_SEC 1000000000 +// no CLOCK_MONOTONIC_RAW on FreeBSD as of 12.0 :/ +#ifndef CLOCK_MONOTONIC_RAW +#define CLOCK_MONOTONIC_RAW CLOCK_MONOTONIC +#endif + #ifdef __cplusplus } #endif