43 void set(
const timespec& t);
58 [[nodiscard]]
bool active(
const timespec& t)
const;
68 inline void disable();
75 [[nodiscard]]
inline bool isEnabled()
const;
82 [[nodiscard]]
inline const TimeSpec& getInterval()
const;
88 [[nodiscard]]
inline const TimeSpec& getTarget()
const;
125 explicit inline operator bool()
const;
133 inline bool operator()(
const timespec& t)
const;
147 bool _enabled{
false};
180inline IntervalTimer::operator bool()
const
Timer class that has fixed time intervals at which it becomes true.
Definition IntervalTimer.h:14
bool active(const timespec &t) const
Allows passing timespec value our self to reduce overhead in case of multiple timers.
TimeSpec getTimeOver(const timespec &t) const
Same as time left, but it also gives the time passed the target time and before that as a negative va...
IntervalTimer()=default
Default constructor.
const TimeSpec & getTarget() const
Gets the set interval time in TimeSpec format.
Definition IntervalTimer.h:175
IntervalTimer(int usec)
Initializing constructor setting the elapse time in usec.
IntervalTimer(double sec)
Initializing constructor setting the elapse time in seconds and fraction using a double.
void enable()
Enables the timer with the current interval time.
Definition IntervalTimer.h:155
bool active() const
Tests if the timer is active if it is active it returns non-zero and resets the timer to a new event.
bool isEnabled() const
Gets timer enabled.
Definition IntervalTimer.h:165
TimeSpec getTimeOver() const
Same as time left, but it also gives the time passed the target time and before that as a negative va...
const TimeSpec & getInterval() const
Gets the set interval time in TimeSpec format.
Definition IntervalTimer.h:170
TimeSpec getTimeLeft(const timespec &t) const
Gets the time left in TimeSpec format before function active becomes true.
void disable()
Disables the timer.
Definition IntervalTimer.h:160
void set(const timespec &t)
Sets the timers interval time.
bool operator()(const timespec &t) const
Definition IntervalTimer.h:185
TimeSpec getTimeLeft() const
Gets the time left in msec before function active becomes true.
#define _MISC_CLASS
Definition misc/global.h:40
Definition Application.h:10
Class wrapper for timespec structure to modify.
Definition TimeSpec.h:12