OpenAstra
 
Loading...
Searching...
No Matches
timer.h
1#ifndef TIMER_H
2#define TIMER_H
3
4#include <stdint.h>
5
6class Timer
7{
8public:
9 Timer(bool autostart = false);
10 virtual ~Timer();
11
12 void setHighPrecision();
13
14 uint64_t start();
15
16 bool isRunning() const;
17
18 bool isPaused() const;
19
20 void reset();
21
22 void stopReset();
23
24 void pause();
25
26 void resume();
27
28 void setLoopTime( uint64_t usecs );
29
30 int64_t waitLoop();
31
32 int64_t waitLoopAdjusted( int64_t adjustment_us );
33
34 bool elapsedLoop() const;
35
36 uint64_t elapsedTime() const;
37
38 uint64_t elapsedTimeMS() const;
39
40 uint64_t elapsedTimeS() const;
41
42 uint64_t stop();
43
44 int64_t usleep( int64_t usecs );
45
46 int64_t sleep( int32_t secs );
47
48 int64_t msleep(int32_t msecs );
49
50 static int64_t usleep_s( int64_t usecs );
51
52 static int64_t usleep_s( int64_t usecs, bool use_high_precision );
53
54 static int64_t sleep_s( int32_t secs );
55
56 static int64_t sleep_s( int32_t secs, bool use_high_precision );
57
58 static int64_t msleep_s(int32_t msecs );
59
60 static int64_t msleep_s(int32_t msecs, bool use_high_precision );
61
62 static uint64_t getCurrentTime();
63
64 static uint64_t getCurrentTimeNS();
65
66 static uint64_t getCurrentTimeS();
67
68 static uint64_t getTimeEpoc();
69
70 static uint64_t getTimeEpocMS();
71
72 static uint64_t getTimeEpocUS();
73
74 static uint64_t convertEpocToUTC_us( uint64_t epoc_us );
75
76private:
77 class __TimerPrivate;
78 __TimerPrivate* _private;
79};
80
81
82#endif // TIMER_H