23 #include <type_traits>
46 QueryPerformanceFrequency(&
m_freq);
47 assert(
m_freq.QuadPart != 0);
58 #define LARGE_INTEGER_NUMS reinterpret_cast<LARGE_INTEGER*>(largeInts)
60 #define TIMEVAL_NUMS reinterpret_cast<struct timeval*>(largeInts)
69 sizeof(
largeInts) >= 2 *
sizeof(LARGE_INTEGER),
70 "sizeof(LARGE_INTEGER) failed!");
73 sizeof(
largeInts) >= 2 *
sizeof(
struct timeval),
74 "sizeof(struct timeval) failed!");
83 QueryPerformanceCounter(&l[0]);
85 struct timeval* ts = TIMEVAL_NUMS;
86 gettimeofday(&ts[0],
nullptr);
94 QueryPerformanceCounter(&l[1]);
95 return (l[1].QuadPart - l[0].QuadPart) *
98 struct timeval* ts = TIMEVAL_NUMS;
99 gettimeofday(&ts[1],
nullptr);
100 return (ts[1].tv_sec - ts[0].tv_sec) +
101 1e-6 * (ts[1].tv_usec - ts[0].tv_usec);