From d3bb5b13e4c8aae6736b9a80bcc60ec7b5460fcc Mon Sep 17 00:00:00 2001 From: Thulinma Date: Tue, 17 Jun 2014 12:07:35 +0200 Subject: [PATCH] Fixed Mac support --- lib/defines.h | 2 +- lib/timing.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/defines.h b/lib/defines.h index 15c673ba..bc686b3d 100644 --- a/lib/defines.h +++ b/lib/defines.h @@ -20,7 +20,7 @@ #include "config.h" static const char* DBG_LVL_LIST[] = {"NONE","FAIL","ERROR","WARN","INFO","MEDIUM","HIGH","VERYHIGH","EXTREME","INSANE","DONTEVEN"}; - #ifdef __GNUC__ + #if !defined(__APPLE__) && !defined(__MACH__) && defined(__GNUC__) #include extern char * program_invocation_short_name; diff --git a/lib/timing.cpp b/lib/timing.cpp index 58ac0def..6185603f 100644 --- a/lib/timing.cpp +++ b/lib/timing.cpp @@ -4,17 +4,17 @@ #include "timing.h" #include //for gettimeofday #include //for time and nanosleep -#include //forsysinfo //emulate clock_gettime() for OSX compatibility #if defined(__APPLE__) || defined(__MACH__) #include #include -#define CLOCK_REALTIME 0 +#define CLOCK_REALTIME CALENDAR_CLOCK +#define CLOCK_MONOTONIC SYSTEM_CLOCK void clock_gettime(int ign, struct timespec * ts){ clock_serv_t cclock; mach_timespec_t mts; - host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock); + host_get_clock_service(mach_host_self(), ign, &cclock); clock_get_time(cclock, &mts); mach_port_deallocate(mach_task_self(), cclock); ts->tv_sec = mts.tv_sec;