FreeBSD: no CLOCK_MONOTONIC_RAW #196

pull/232/head
nick black 5 years ago committed by Nick Black
parent caf7e41737
commit 09aa606281

@ -17,7 +17,7 @@ int box_demo(struct notcurses* nc){
return -1; return -1;
} }
struct timespec start, now; struct timespec start, now;
clock_gettime(CLOCK_MONOTONIC_RAW, &start); clock_gettime(CLOCK_MONOTONIC, &start);
int zbonus = 40; int zbonus = 40;
int zbonusdelta = 20; int zbonusdelta = 20;
int ylen, xlen; int ylen, xlen;
@ -86,7 +86,7 @@ int box_demo(struct notcurses* nc){
return -1; return -1;
} }
nanosleep(&iterdelay, NULL); nanosleep(&iterdelay, NULL);
clock_gettime(CLOCK_MONOTONIC_RAW, &now); clock_gettime(CLOCK_MONOTONIC, &now);
if((zbonus += zbonusdelta > 255) || zbonus < 0){ if((zbonus += zbonusdelta > 255) || zbonus < 0){
zbonusdelta = -zbonusdelta; zbonusdelta = -zbonusdelta;
zbonus += zbonusdelta; zbonus += zbonusdelta;

@ -2,6 +2,7 @@
#define NOTCURSES_INTERNAL #define NOTCURSES_INTERNAL
#include <term.h> #include <term.h>
#include <time.h>
#include <stdio.h> #include <stdio.h>
#include <stdint.h> #include <stdint.h>
#include <stdarg.h> #include <stdarg.h>
@ -263,6 +264,11 @@ cell* ncplane_cell_ref_yx(ncplane* n, int y, int x);
#define NANOSECS_IN_SEC 1000000000 #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 #ifdef __cplusplus
} }
#endif #endif

Loading…
Cancel
Save