1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-20 21:43:06 +01:00
Files
OpenRCT2/src/core/Stopwatch.hpp
2016-01-08 20:50:23 +00:00

36 lines
527 B
C++

#pragma once
extern "C" {
#include "../common.h"
}
/**
* Class to accuately measure elapsed time with high precision.
*/
class Stopwatch
{
private:
/** Number of ticks in a second. */
static uint64 Frequency;
uint64 _total;
uint64 _last;
bool _isRunning;
static uint64 QueryFrequency();
static uint64 QueryCurrentTicks();
public:
bool IsRunning() { return _isRunning; }
Stopwatch();
uint64 GetElapsedTicks();
uint64 GetElapsedMilliseconds();
void Reset();
void Start();
void Restart();
void Stop();
};