libxdo
patch_clock_gettime.h
1 
2 /* Hack support for clock_gettime into OS X */
3 
4 #define CLOCK_MONOTONIC 1
5 typedef int clockid_t;
6 int clock_gettime(clockid_t clk_id, struct timespec *res) {
7  struct timeval tv;
8  int ret = 0;
9  ret = gettimeofday(&tv, NULL);
10  if (ret == 0) {
11  res->tv_sec = tv.tv_sec;
12  res->tv_nsec = tv.tv_usec * 1000;
13  }
14  return ret;
15 }