Timer.hpp
Go to the documentation of this file.
1 // Timer.hpp
2 //
3 // created: June 6, 2011
4 //
5 // Mit "-lrt" linken!!
6 //
7 
8 #ifndef TIMER_HPP
9 #define TIMER_HPP
10 
11 #include "../BasicDatatypes.hpp"
12 #include "Time.hpp"
13 
15 
24 class Timer
25 {
26 public:
28 
29  Timer();
30 
32  virtual ~Timer ();
33 
35  void restart();
36 
37  // Starts the watchdog timer, with the given timeout interval.
38  // Note that no action is taken, but the timer has to be queried using
39  // isElapsed().
40  void startWatchdog(TimeDuration watchdogTime);
41 
42  // Returns true if the given timeout interval has elapsed.
43  bool isElapsed();
44 
45  // Restarts the timer.
46  void reset();
47 
48  // Returns the elapsed time in seconds since the timer was started or restarted.
49  TimeDuration elapsed () const;
50 // double elapsed () const;
51 
53  UINT32 elapsedMilliseconds () const;
54 
56  UINT32 elapsedMicroseconds () const;
57 
60 
61 // static timeval now(); // Returns the current time
62 
63 private:
65  TimeDuration m_watchdogTime; // Zeitintervall des Watchdog
66 };
67 
68 #endif // TIMER_HPP
UINT32 elapsedMicrosecondsSinceLastCall()
Elapsed us since the last call of this function.
Definition: Timer.cpp:141
UINT32 elapsedMillisecondsSinceLastCall()
Elapsed ms since the last call of this function.
Definition: Timer.cpp:130
void reset()
Definition: Timer.cpp:48
virtual ~Timer()
Destructor.
Definition: Timer.cpp:16
Time m_startTime
Definition: Timer.hpp:64
Definition: Time.hpp:44
TimeDuration elapsed() const
Definition: Timer.cpp:78
uint32_t UINT32
UINT32 elapsedMicroseconds() const
Returns the elapsed time in microseconds since the timer was started or restarted.
Definition: Timer.cpp:105
Timer()
Constructor.
Definition: Timer.cpp:11
TimeDuration m_watchdogTime
Definition: Timer.hpp:65
UINT32 elapsedMilliseconds() const
Returns the elapsed time in milliseconds since the timer was started or restarted.
Definition: Timer.cpp:95
void startWatchdog(TimeDuration watchdogTime)
Definition: Timer.cpp:23
void restart()
Restarts the timer.
Definition: Timer.cpp:56
bool isElapsed()
Definition: Timer.cpp:32
A timer object to measure elapsed time.
Definition: Timer.hpp:24


libsick_ldmrs
Author(s): SICK AG , Martin Günther , Jochen Sprickerhof
autogenerated on Mon Oct 26 2020 03:27:30