-
Notifications
You must be signed in to change notification settings - Fork 0
/
Timer.hpp
executable file
·47 lines (36 loc) · 787 Bytes
/
Timer.hpp
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
/*
* Timer.hpp
*
* Li-Yi Wei
* 4/15/2003
*
*/
#ifndef _TIMER_HPP
#define _TIMER_HPP
#include <winsock.h>
class Timer
{
public:
Timer(void);
virtual ~Timer(void);
// start the timer
// return 1 if successful, 0 else
int Start(void);
// stop the timer
// return 1 if successful, 0 else
int Stop(void);
// get the real (elapsted) time in seconds
double ElapsedTime(void) const;
// get the current system time in seconds
double CurrentTime(void) const;
protected:
typedef DWORD Time;
// compute the elapsed time in seconds
double ElapsedTime(const Time & startTime,
const Time & endTime) const;
protected:
Time _startRealTime;
Time _stopRealTime;
int _started;
};
#endif