-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTimeManager.h
More file actions
45 lines (37 loc) · 1.08 KB
/
TimeManager.h
File metadata and controls
45 lines (37 loc) · 1.08 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
#pragma once
#ifndef _TIME_MANAGER_H_
#define _TIME_MANAGER_H_
#ifdef WIN32 // Windows system specific
#include <windows.h>
#else // Unix based system specific
#include <sys/time.h>
#endif
class TimeManager
{
public:
// CTOR
//
TimeManager();
// DTOR
//
~TimeManager();
void start();
void stop();
double getElapsedTime(); // By default elapsed time is returned in seconds.
double getElapsedTimeInSeconds(); // Returns elapsed time in seconds.
double getElapsedTimeInMicroseconds(); // Returns elapsed time in microseconds.
double getElapsedTimeInMilliseconds(); // Returns elapsed time in milliseconds.
private:
double m_startTimeInMicroSeconds;
double m_endTimeInMicroSeconds;
int m_stopped;
#ifdef WIN32
LARGE_INTEGER m_frequency;
LARGE_INTEGER m_startCount;
LARGE_INTEGER m_endCount;
#else
timeval m_startCount;
timeval m_endCount;
#endif
};
#endif // _TIME_MANAGER_H_