okapi::Rate class

Base classes

class AbstractRate

Constructors, destructors, conversion operators

Rate()

Public functions

void delay(QFrequency ihz) override
Delay the current task such that it runs at the given frequency.
void delayUntil(QTime itime) override
Delay the current task until itime has passed.
void delayUntil(uint32_t ims) override
Delay the current task until ims milliseconds have passed.

Protected variables

std::uint32_t lastTime

Function documentation

void okapi::Rate::delay(QFrequency ihz) override

Delay the current task such that it runs at the given frequency.

Parameters
ihz the frequency

The first delay will run for 1000/(ihz). Subsequent delays will adjust according to the previous runtime of the task.

void okapi::Rate::delayUntil(QTime itime) override

Delay the current task until itime has passed.

Parameters
itime the time period

This method can be used by periodic tasks to ensure a consistent execution frequency.

void okapi::Rate::delayUntil(uint32_t ims) override

Delay the current task until ims milliseconds have passed.

Parameters
ims the time period

This method can be used by periodic tasks to ensure a consistent execution frequency.