since the latter is not available.
* We also align to 60 seconds modulo interval such
* that we start with :00 on every new minute. */
struct timespec ts;
* We also align to 60 seconds modulo interval such
* that we start with :00 on every new minute. */
struct timespec ts;
+#if defined(__APPLE__)
+ gettimeofday(&tv, NULL);
+ ts.tv_sec = tv.tv_sec;
+#else
clock_gettime(CLOCK_REALTIME, &ts);
clock_gettime(CLOCK_REALTIME, &ts);
ts.tv_sec += interval - (ts.tv_sec % interval);
ts.tv_nsec = 0;
ts.tv_sec += interval - (ts.tv_sec % interval);
ts.tv_nsec = 0;