-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathwindowstimer.cpp
More file actions
31 lines (29 loc) · 1 KB
/
windowstimer.cpp
File metadata and controls
31 lines (29 loc) · 1 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
#include "windowstimer.h"
//------------------------------------------------------------------------------
WindowsTimer::WindowsTimer()
{
}
//------------------------------------------------------------------------------
WindowsTimer::~WindowsTimer()
{
}
//------------------------------------------------------------------------------
void WindowsTimer::start()
{
QueryPerformanceCounter(&this->time1);
}
//------------------------------------------------------------------------------
void WindowsTimer::stop()
{
QueryPerformanceCounter(&this->time2);
}
//------------------------------------------------------------------------------
double WindowsTimer::getTime()
{
LARGE_INTEGER freq;
QueryPerformanceFrequency(&freq);
long long int diffTicks = this->time2.QuadPart - this->time1.QuadPart;
return (double)((double)diffTicks/(double)(freq.QuadPart));
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------