mirror of
https://github.com/libretro/Mesen.git
synced 2024-11-30 12:30:52 +00:00
35 lines
542 B
C++
35 lines
542 B
C++
#include "stdafx.h"
|
|
|
|
class Timer
|
|
{
|
|
private:
|
|
double _frequency = 0.0;
|
|
LARGE_INTEGER _start;
|
|
|
|
public:
|
|
Timer() {
|
|
LARGE_INTEGER li;
|
|
if(!QueryPerformanceFrequency(&li)) {
|
|
throw;
|
|
}
|
|
|
|
_frequency = double(li.QuadPart) / 1000.0;
|
|
|
|
QueryPerformanceCounter(&li);
|
|
_start = li;
|
|
}
|
|
|
|
void Reset()
|
|
{
|
|
LARGE_INTEGER li;
|
|
QueryPerformanceCounter(&li);
|
|
_start = li;
|
|
}
|
|
|
|
double GetElapsedMS()
|
|
{
|
|
LARGE_INTEGER li;
|
|
QueryPerformanceCounter(&li);
|
|
return double(li.QuadPart - _start.QuadPart) / _frequency;
|
|
}
|
|
}; |