7 #include <mach/clock.h>
14 typedef unsigned long time_type;
16 inline time_type get_time()
18 #ifdef __MACH__ // OS X does not have clock_gettime, use clock_get_time
21 host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock);
22 clock_get_time(cclock, &ts);
23 mach_port_deallocate(mach_task_self(), cclock);
26 clock_gettime(CLOCK_REALTIME, &ts);
28 return ts.tv_sec*1000 + ts.tv_nsec/1000000;