-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTimer.hpp
More file actions
56 lines (46 loc) · 1.06 KB
/
Timer.hpp
File metadata and controls
56 lines (46 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#pragma once
#include <chrono>
#ifdef _WIN32
#include <Windows.h>
#define WCLOCK
#endif
namespace Core
{
class HighresTimer
{
#ifndef WCLOCK
std::chrono::high_resolution_clock::time_point m_start, m_end;
std::chrono::high_resolution_clock::time_point m_totalStart;
#else
private:
LARGE_INTEGER m_frequency; // ticks per second
LARGE_INTEGER m_totalStart;
LARGE_INTEGER m_start, m_end; // ticks
#endif
long long m_totalTime;
public:
HighresTimer();
/*!
Starts measuring time
*/
void Start();
/*!
Stops measuring time
*/
void Stop();
/*!
Resets the total time to now
*/
void Reset();
/*!
Gets the delta time
\return Returns time passed between calling Start and Stop
*/
std::chrono::microseconds GetDelta();
/*!
Gets the total time
\return Returns the total time passed since the application started
*/
long long GetTotal();
};
}