/
Timer.h
62 lines (45 loc) · 2.04 KB
/
Timer.h
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
61
62
////////////////////////////////////////////////////////////////////////////////
// -------------------------------------------------------------------------- //
// //
// (C) 2010-2016 Robot Developers //
// See LICENSE for licensing info //
// //
// -------------------------------------------------------------------------- //
////////////////////////////////////////////////////////////////////////////////
//----------------------------------------------------------------------------//
// Prefaces //
//----------------------------------------------------------------------------//
#pragma once
#include "Types.h"
ROBOT_NS_BEGIN
//----------------------------------------------------------------------------//
// Classes //
//----------------------------------------------------------------------------//
////////////////////////////////////////////////////////////////////////////////
class ROBOT_EXPORT Timer
{
public:
Timer (void);
public:
void Start (void);
uint64 Reset (void);
uint64 Restart (void);
uint64 GetElapsed (void) const;
bool HasStarted (void) const;
bool HasExpired (uint64 time) const;
static void Sleep (const Range& time);
static void Sleep (uint32 minimum,
uint32 maximum);
static uint64 GetCpuTime (void);
public:
uint64 operator () (void) const;
bool operator < (const Timer& timer) const;
bool operator > (const Timer& timer) const;
bool operator <= (const Timer& timer) const;
bool operator >= (const Timer& timer) const;
bool operator == (const Timer& timer) const;
bool operator != (const Timer& timer) const;
private:
uint64 mStarted; // Time started (milliseconds)
};
ROBOT_NS_END