Enderal SE https://mod.pub/enderal-se/38-enderal-se
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
627 B
39 lines
627 B
3 years ago
|
#pragma once
|
||
|
|
||
|
#include "common/ITypes.h"
|
||
|
|
||
|
/**
|
||
|
* A high-resolution timer.
|
||
|
*/
|
||
|
class ITimer
|
||
|
{
|
||
|
public:
|
||
|
ITimer();
|
||
|
~ITimer();
|
||
|
|
||
|
static void Init(void);
|
||
|
static void DeInit(void);
|
||
|
|
||
|
void Start(void);
|
||
|
|
||
|
double GetElapsedTime(void); // seconds
|
||
|
|
||
|
private:
|
||
|
UInt64 m_qpcBase; // QPC
|
||
|
UInt32 m_tickBase; // timeGetTime
|
||
|
|
||
|
static double s_secondsPerCount;
|
||
|
static TIMECAPS s_timecaps;
|
||
|
static bool s_setTime;
|
||
|
|
||
|
// safe QPC stuff
|
||
|
static UInt64 GetQPC(void);
|
||
|
|
||
|
static UInt64 s_lastQPC;
|
||
|
static UInt64 s_qpcWrapMargin;
|
||
|
static bool s_hasLastQPC;
|
||
|
|
||
|
static UInt32 s_qpcWrapCount;
|
||
|
static UInt32 s_qpcInaccurateCount;
|
||
|
};
|