Skip to content

iox::cxx::DeadlineTimer🔗

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>

Public Functions🔗

Name
DeadlineTimer(const iox::units::Duration timeToWait)
Constructor.
bool hasExpired() const
Checks if the timer has expired compared to its absolute end time.
void reset()
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)
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
calculates the remaining time before the timer goes off

Detailed Description🔗

class iox::cxx::DeadlineTimer;

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.

iox::cxx::DeadlineTimer deadlineTimer(1000_ms);

// to check if the timer is active
if( deadlineTimer.hasExpired()){
...
}
// to reset the timer and start again with the same duration
deadlineTimer.reset();

Public Functions Documentation🔗

function DeadlineTimer🔗

explicit DeadlineTimer(
    const iox::units::Duration timeToWait
)

Constructor.

Parameters:

  • timeToWait duration until the timer expires

function hasExpired🔗

bool hasExpired() const

Checks if the timer has expired compared to its absolute end time.

Return: false if the timer is still active and true if it is expired

function reset🔗

void reset()

reinitializes the ending time for the timer. The absolute end time is calculated by adding time to wait to the current time.

function reset🔗

void reset(
    const iox::units::Duration timeToWait
)

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:

  • timeToWait duration until the timer expires. This value overwrites the earlier value which was set during the timer creation.

function remainingTime🔗

iox::units::Duration remainingTime() const

calculates the remaining time before the timer goes off

Return: the time duration before the timer expires


Updated on 18 December 2023 at 13:11:42 CET