This offers the deadline timer functionality. It has user convenient methods to reset the timer [by default it uses the intialized duration], reset timer to a customized duration, check if the timer is active and user can also get to know about the remaining time before the timer goes off.
More...
#include <iceoryx_hoofs/cxx/deadline_timer.hpp>
|
| DeadlineTimer (const iox::units::Duration timeToWait) noexcept |
| Constructor.
|
|
bool | hasExpired () const noexcept |
| Checks if the timer has expired compared to its absolute end time.
|
|
void | reset () noexcept |
| reinitializes the ending time for the timer. The absolute end time is calculated by adding time to wait to the current time.
|
|
void | reset (const iox::units::Duration timeToWait) noexcept |
| reinitializes the ending time for the timer to the given new time to wait. The absolute end time is calculated by adding new time to wait to the current time.
|
|
iox::units::Duration | remainingTime () const noexcept |
| calculates the remaining time before the timer goes off
|
|
This offers the deadline timer functionality. It has user convenient methods to reset the timer [by default it uses the intialized duration], reset timer to a customized duration, check if the timer is active and user can also get to know about the remaining time before the timer goes off.
if( deadlineTimer.hasExpired()){
...
}
deadlineTimer.reset();
This offers the deadline timer functionality. It has user convenient methods to reset the timer [by d...
Definition deadline_timer.hpp:44
◆ DeadlineTimer()
iox::cxx::DeadlineTimer::DeadlineTimer |
( |
const iox::units::Duration |
timeToWait | ) |
|
|
explicitnoexcept |
Constructor.
- Parameters
-
[in] | timeToWait | duration until the timer expires |
◆ hasExpired()
bool iox::cxx::DeadlineTimer::hasExpired |
( |
| ) |
const |
|
noexcept |
Checks if the timer has expired compared to its absolute end time.
- Returns
- false if the timer is still active and true if it is expired
◆ remainingTime()
iox::units::Duration iox::cxx::DeadlineTimer::remainingTime |
( |
| ) |
const |
|
noexcept |
calculates the remaining time before the timer goes off
- Returns
- the time duration before the timer expires
◆ reset()
void iox::cxx::DeadlineTimer::reset |
( |
const iox::units::Duration |
timeToWait | ) |
|
|
noexcept |
reinitializes the ending time for the timer to the given new time to wait. The absolute end time is calculated by adding new time to wait to the current time.
- Parameters
-
[in] | timeToWait | duration until the timer expires. This value overwrites the earlier value which was set during the timer creation. |
The documentation for this class was generated from the following file: