1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-23 06:44:38 +01:00
Files
OpenRCT2/src/core/Stopwatch.hpp
2016-01-23 18:58:31 +00:00

37 lines
603 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() const { return _isRunning; }
Stopwatch();
uint64 GetElapsedTicks() const;
uint64 GetElapsedMilliseconds() const;
void Reset();
void Start();
void Restart();
void Stop();
};