39 #include <mach/clock.h> 40 #include <mach/mach.h> 47 _start_time(curTime())
53 _start_time = curTime();
58 return double(curTime() - _start_time) / double(1000000000);
63 #ifdef __MACH__ // OS X does not have clock_gettime, use clock_get_time 64 clock_serv_t host_clock;
66 host_get_clock_service(mach_host_self(), SYSTEM_CLOCK, &host_clock);
67 clock_get_time(host_clock, &now);
68 return Time(now.tv_sec) * Time(1000000000) + Time(now.tv_nsec);
71 #ifdef CLOCK_PROCESS_CPUTIME_ID 72 clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &ts);
73 #else // BSD and old Linux 74 clock_gettime(CLOCK_PROF, &ts);
76 return Time(ts.tv_sec) * Time(1000000000) + Time(ts.tv_nsec);
80 #endif // _POSIX_TIMERS
Functions and classes that are not dependant on scalar type are defined in this namespace.