109 time_t secLast = time.tv_sec;
110 long nsecLast = time.tv_nsec;
112 clock_gettime(CLOCK_MONOTONIC, &time);
113 return (
double)(time.tv_sec - secLast)
114 + (
double)(time.tv_nsec - nsecLast) *
NSEC;
116 uint64_t lastTime = time;
117 uint64_t time = mach_absolute_time();
118 static mach_timebase_info_data_t info = {0, 0};
120 if (info.denom == 0) mach_timebase_info(&info);
121 return ((time - lastTime) * (info.numer / info.denom)) *
NSEC;
127 "WARNING: Unable to update time, clock not running.\n");