Fixed Mac support
This commit is contained in:
parent
8f97995b1b
commit
d3bb5b13e4
2 changed files with 4 additions and 4 deletions
|
@ -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 <errno.h>
|
||||
extern char * program_invocation_short_name;
|
||||
|
||||
|
|
|
@ -4,17 +4,17 @@
|
|||
#include "timing.h"
|
||||
#include <sys/time.h>//for gettimeofday
|
||||
#include <time.h>//for time and nanosleep
|
||||
#include <sys/sysinfo.h> //forsysinfo
|
||||
|
||||
//emulate clock_gettime() for OSX compatibility
|
||||
#if defined(__APPLE__) || defined(__MACH__)
|
||||
#include <mach/clock.h>
|
||||
#include <mach/mach.h>
|
||||
#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;
|
||||
|
|
Loading…
Add table
Reference in a new issue