diff --git a/src/misc.c b/src/misc.c index e5a0a6e76..eccb7ba15 100644 --- a/src/misc.c +++ b/src/misc.c @@ -60,22 +60,23 @@ #ifdef __APPLE__ -#include +#include -#if AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER +#if !defined(CLOCK_REALTIME) && !defined(CLOCK_MONOTONIC) +// +// MacOS < 10.12 does not have clock_gettime +// +// Contribution from github user "ra1nb0w" +// -#else - -# include -# ifndef __clockid_t_defined +#define CLOCK_REALTIME 0 +#define CLOCK_MONOTONIC 6 typedef int clockid_t; -#define __clockid_t_defined 1 -# endif /* __clockid_t_defined */ -# define CLOCK_REALTIME 0 -# define CLOCK_MONOTONIC 1 +#include +#include -int clock_gettime(clockid_t clock_id, struct timespec *tp) +static int clock_gettime(clockid_t clock_id, struct timespec *tp) { if (clock_id == CLOCK_REALTIME) {