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

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

parent cd148336
......@@ -6,6 +6,27 @@
#include <errno.h>
#include <string.h>
#ifdef __MACH__
// copied mostly from
/* OS X doesn't have clock_gettime, sigh */
#include <mach/clock.h>
#include <mach/mach.h>
typedef int clockid_t;
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) */
// 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