-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtimer.h
More file actions
41 lines (38 loc) · 667 Bytes
/
Copy pathtimer.h
File metadata and controls
41 lines (38 loc) · 667 Bytes
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
/*
* timer.h
* returs elapsed time in micro-sec
*/
#if defined(WIN32)
#include <windows.h>
#endif
#if defined(unix)|| defined(__APPLE__)
#include <sys/time.h>
#include <unistd.h>
#endif
#if defined(WIN32)
typedef struct
{
LARGE_INTEGER start;
LARGE_INTEGER stop;
} stopWatch;
#endif
class CStopWatch
{
private:
#if defined(WIN32)
stopWatch timer;
LARGE_INTEGER frequency;
double LIToSecs( LARGE_INTEGER & L);
#endif
#if defined(unix)|| defined(__APPLE__)
struct timeval start,end;
struct timezone tz;
double time_total;
#endif
public:
CStopWatch();
void startTimer( );
void stopTimer( );
double getElapsedTime();
void refreshTimer( );
};