31#if !(defined(WIN32) || defined(_WIN32) || defined(WIN64) || defined(_WIN64))
34# include <sys/types.h>
52filetime2msec(FILETIME* t)
54 return (clock_t)((((float) t->dwHighDateTime) * 429496.7296) +
55 (((float) t->dwLowDateTime) * .0001));
63 FILETIME ct = { 0, 0 }, et = { 0, 0 }, st = { 0, 0 }, ut = { 0, 0 }, rt = { 0, 0 };
66 GetSystemTime(&realtime);
67 SystemTimeToFileTime(&realtime, &rt);
70 GetProcessTimes(GetCurrentProcess(), &ct, &et, &st,
72 t->tms_utime = t->tms_cutime = filetime2msec(&ut);
73 t->tms_stime = t->tms_cstime = filetime2msec(&st);
75 return filetime2msec(&rt);
89 throw std::runtime_error(
"Timer::GetRealElapsed() - "
90 "Timer not stopped or times not recorded!");
92 std::chrono::duration<double> diff = fEndRealTime - fStartRealTime;
103 throw std::runtime_error(
"Timer::GetSystemElapsed() - "
104 "Timer not stopped or times not recorded!");
106 double diff = fEndTimes.tms_stime - fStartTimes.tms_stime;
107 return diff / sysconf(_SC_CLK_TCK);
117 throw std::runtime_error(
"Timer::GetUserElapsed() - "
118 "Timer not stopped or times not recorded!");
120 double diff = fEndTimes.tms_utime - fStartTimes.tms_utime;
121 return diff / sysconf(_SC_CLK_TCK);
double GetUserElapsed() const
double GetRealElapsed() const
double GetSystemElapsed() const