Commit 2f401e35 authored by Jordan Sissel's avatar Jordan Sissel

- OS X doesn't have clock_gettime(3), so like, implement it or

something.
parent cd148336
......@@ -6,6 +6,27 @@
#include <errno.h>
#include <string.h>
#ifdef __MACH__
// copied mostly from https://gist.github.com/1087739
/* OS X doesn't have clock_gettime, sigh */
#include <mach/clock.h>
#include <mach/mach.h>
typedef int clockid_t;
#define CLOCK_MONOTONIC 1
long clock_gettime(clockid_t __attribute__((unused)) which_clock, struct timespec *tp) {
clock_serv_t cclock;
mach_timespec_t mts;
host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock);
clock_get_time(cclock, &mts);
mach_port_deallocate(mach_task_self(), cclock);
tp->tv_sec = mts.tv_sec;
tp->tv_nsec = mts.tv_nsec;
return 0; /* success, according to clock_gettime(3) */
}
#endif
// end gist copy
void *emitter(void *arg) {
struct emitter_config *config = arg;
int rc;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment