mirror of
https://github.com/cemu-project/Cemu.git
synced 2025-07-09 08:21:18 +12:00
Optimized timer code for macOS (#576)
This commit is contained in:
parent
fcab8f8f1a
commit
058d11b49b
3 changed files with 17 additions and 9 deletions
|
@ -7,11 +7,13 @@ HighResolutionTimer HighResolutionTimer::now()
|
|||
LARGE_INTEGER pc;
|
||||
QueryPerformanceCounter(&pc);
|
||||
return HighResolutionTimer(pc.QuadPart);
|
||||
#else
|
||||
#elif BOOST_OS_LINUX
|
||||
timespec pc;
|
||||
clock_gettime(CLOCK_MONOTONIC_RAW, &pc);
|
||||
uint64 nsec = (uint64)pc.tv_sec * (uint64)1000000000 + (uint64)pc.tv_nsec;
|
||||
return HighResolutionTimer(nsec);
|
||||
#elif BOOST_OS_MACOS
|
||||
return HighResolutionTimer(clock_gettime_nsec_np(CLOCK_MONOTONIC_RAW));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -20,7 +22,6 @@ HRTick HighResolutionTimer::getFrequency()
|
|||
return m_freq;
|
||||
}
|
||||
|
||||
|
||||
uint64 HighResolutionTimer::m_freq = []() -> uint64 {
|
||||
#if BOOST_OS_WINDOWS
|
||||
LARGE_INTEGER freq;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue