-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWaitTimer.cpp
More file actions
60 lines (43 loc) · 1.3 KB
/
WaitTimer.cpp
File metadata and controls
60 lines (43 loc) · 1.3 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
57
58
59
60
// WaitTimer.cpp: implementation of the CWaitTimer class.
//
//////////////////////////////////////////////////////////////////////
#include "WaitTimer.h"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CWaitTimer::CWaitTimer()
{
start_clock_count = 0;
Start_Clock();
}
CWaitTimer::~CWaitTimer()
{
}
DWORD CWaitTimer::Get_Clock(void)
{
// this function returns the current tick count
// return time
return(GetTickCount());
} // end Get_Clock
///////////////////////////////////////////////////////////
DWORD CWaitTimer::Start_Clock(void)
{
// this function starts the clock, that is, saves the current
// count, use in conjunction with Wait_Clock()
return(start_clock_count = Get_Clock());
} // end Start_Clock
////////////////////////////////////////////////////////////
DWORD CWaitTimer::Wait_Clock(DWORD count)
{
// this function is used to wait for a specific number of clicks
// since the call to Start_Clock
Sleep(count);
return 1;
/*while((Get_Clock() - start_clock_count) < count);
return(Get_Clock());*/
} // end Wait_Clock
DWORD CWaitTimer::Get_Seconds_Elapsed()
{
// Returns the number of seconds elapsed since clock started.
return (Get_Clock() - start_clock_count);
}