12 #if defined(GTE_NEEDS_64_BIT_CLOCK) 23 LARGE_INTEGER frequency = { 1 },
counter = { 0 };
24 QueryPerformanceFrequency(&frequency);
25 QueryPerformanceCounter(&
counter);
26 mFrequency =
static_cast<int64_t
>(frequency.QuadPart);
27 mInitialTicks =
static_cast<int64_t
>(
counter.QuadPart);
28 mInvFrequency = 1.0 /
static_cast<double>(mFrequency);
33 int64_t ticks = GetTicks();
34 double seconds = mInvFrequency *
static_cast<double>(ticks);
35 int64_t nanoseconds =
static_cast<int64_t
>(ceil(1000000000.0 * seconds));
41 int64_t ticks = GetTicks();
42 double seconds = mInvFrequency *
static_cast<double>(ticks);
43 int64_t microseconds =
static_cast<int64_t
>(ceil(1000000.0 * seconds));
49 int64_t ticks = GetTicks();
50 double seconds = mInvFrequency *
static_cast<double>(ticks);
51 int64_t milliseconds =
static_cast<int64_t
>(ceil(1000.0 * seconds));
57 int64_t ticks = GetTicks();
58 double seconds = mInvFrequency *
static_cast<double>(ticks);
65 QueryPerformanceCounter(&counter);
66 mInitialTicks =
static_cast<int64_t
>(counter.QuadPart);
69 int64_t Timer::GetTicks()
const 72 QueryPerformanceCounter(&counter);
73 return static_cast<int64_t
>(counter.QuadPart) - mInitialTicks;
85 auto currentTime = std::chrono::high_resolution_clock::now();
86 return std::chrono::duration_cast<std::chrono::nanoseconds>(
87 currentTime - mInitialTime).
count();
92 auto currentTime = std::chrono::high_resolution_clock::now();
93 return std::chrono::duration_cast<std::chrono::microseconds>(
94 currentTime - mInitialTime).
count();
99 auto currentTime = std::chrono::high_resolution_clock::now();
100 return std::chrono::duration_cast<std::chrono::milliseconds>(
101 currentTime - mInitialTime).
count();
106 int64_t msecs = GetMilliseconds();
107 return static_cast<double>(msecs) / 1000.0;
112 mInitialTime = std::chrono::high_resolution_clock::now();
int64_t GetMilliseconds() const
double GetSeconds() const
int64_t GetMicroseconds() const
int64_t GetNanoseconds() const