okapi::AbstractTimer class

Derived classes

class Timer

Constructors, destructors, conversion operators

AbstractTimer(QTime ifirstCalled) explicit
A Timer base class which implements its methods in terms of millis().
~AbstractTimer() virtual

Public functions

auto millis() const -> QTime pure virtual
Returns the current time in units of QTime.
auto getDt() -> QTime virtual
Returns the time passed in ms since the previous call of this function.
auto readDt() const -> QTime virtual
Returns the time passed in ms since the previous call of getDt().
auto getStartingTime() const -> QTime virtual
Returns the time the timer was first constructed.
auto getDtFromStart() const -> QTime virtual
Returns the time since the timer was first constructed.
void placeMark() virtual
Place a time marker.
auto clearMark() -> QTime virtual
Clears the marker.
void placeHardMark() virtual
Place a hard time marker.
auto clearHardMark() -> QTime virtual
Clears the hard marker.
auto getDtFromMark() const -> QTime virtual
Returns the time since the time marker.
auto getDtFromHardMark() const -> QTime virtual
Returns the time since the hard time marker.
auto repeat(QTime time) -> bool virtual
Returns true when the input time period has passed, then resets.
auto repeat(QFrequency frequency) -> bool virtual
Returns true when the input time period has passed, then resets.

Protected variables

QTime firstCalled
QTime lastCalled
QTime mark
QTime hardMark
QTime repeatMark

Function documentation

okapi::AbstractTimer::AbstractTimer(QTime ifirstCalled) explicit

A Timer base class which implements its methods in terms of millis().

Parameters
ifirstCalled the current time

QTime okapi::AbstractTimer::millis() const pure virtual

Returns the current time in units of QTime.

Returns the current time

QTime okapi::AbstractTimer::getDt() virtual

Returns the time passed in ms since the previous call of this function.

Returns The time passed in ms since the previous call of this function

QTime okapi::AbstractTimer::readDt() const virtual

Returns the time passed in ms since the previous call of getDt().

Returns The time passed in ms since the previous call of getDt()

Does not change the time recorded by getDt().

QTime okapi::AbstractTimer::getStartingTime() const virtual

Returns the time the timer was first constructed.

Returns The time the timer was first constructed

QTime okapi::AbstractTimer::getDtFromStart() const virtual

Returns the time since the timer was first constructed.

Returns The time since the timer was first constructed

void okapi::AbstractTimer::placeMark() virtual

Place a time marker.

Placing another marker will overwrite the previous one.

QTime okapi::AbstractTimer::clearMark() virtual

Clears the marker.

Returns The old marker

void okapi::AbstractTimer::placeHardMark() virtual

Place a hard time marker.

Placing another hard marker will not overwrite the previous one; instead, call clearHardMark() and then place another.

QTime okapi::AbstractTimer::clearHardMark() virtual

Clears the hard marker.

Returns The old hard marker

QTime okapi::AbstractTimer::getDtFromMark() const virtual

Returns the time since the time marker.

Returns The time since the time marker

Returns 0_ms if there is no marker.

QTime okapi::AbstractTimer::getDtFromHardMark() const virtual

Returns the time since the hard time marker.

Returns The time since the hard time marker

Returns 0_ms if there is no hard marker set.

bool okapi::AbstractTimer::repeat(QTime time) virtual

Returns true when the input time period has passed, then resets.

Parameters
time time period
Returns true when the input time period has passed, false after reading true until the period has passed again

Meant to be used in loops to run an action every time period without blocking.

bool okapi::AbstractTimer::repeat(QFrequency frequency) virtual

Returns true when the input time period has passed, then resets.

Parameters
frequency the repeat frequency
Returns true when the input time period has passed, false after reading true until the period has passed again

Meant to be used in loops to run an action every time period without blocking.