AUTh-ARL Core Stack
0.7
|
Provides timing capabilities, like measure the time elapsed since the last call (e.g. useful in a control loop). More...
#include <timer.h>
Public Member Functions | |
Timer () | |
~Timer () | |
void | init () |
Initialize timer to run for the first time. More... | |
double | timeElapsedSinceLastCall () |
Returns the time elapsed in seconds since the last call of this function. Useful in control loops, to know how much time elapsed since the previous control cycle. More... | |
std::string | getCurrentDateTime () |
Returns the current date and time in a string format. More... | |
void | sleep (double input) |
Sleeps for the given amount of seconds. More... | |
void | startPoint () |
Saves locally the current time in order to be used as a starting point from arl::utils::Timer::timeFromStartPoint. Call it in the beginning of the code that you want to measure. More... | |
std::chrono::steady_clock::time_point | getCurrPoint () |
Returns the current time. Useful if used in combination with arl::utils::Timer::timeFromGivenPoint. More... | |
double | timeFromStartPoint () |
Provides the time elapsed in seconds from the last call of arl::utils::Timer::startPoint. More... | |
double | timeFromGivenPoint (const std::chrono::steady_clock::time_point &given_point) |
Provides the time elapsed in seconds from a given point. The given point can be obtained if you first call arl::utils::Timer::getCurrPoint. More... | |
Provides timing capabilities, like measure the time elapsed since the last call (e.g. useful in a control loop).
Example of use:
arl::utils::Timer::Timer | ( | ) |
arl::utils::Timer::~Timer | ( | ) |
std::string arl::utils::Timer::getCurrentDateTime | ( | ) |
Returns the current date and time in a string format.
std::chrono::steady_clock::time_point arl::utils::Timer::getCurrPoint | ( | ) |
Returns the current time. Useful if used in combination with arl::utils::Timer::timeFromGivenPoint.
void arl::utils::Timer::init | ( | ) |
Initialize timer to run for the first time.
Use it in case you want to initialize the arl::utils::Timer::timeElapsedSinceLastCall().
void arl::utils::Timer::sleep | ( | double | input | ) |
Sleeps for the given amount of seconds.
input | The time to sleep in seconds. |
void arl::utils::Timer::startPoint | ( | ) |
Saves locally the current time in order to be used as a starting point from arl::utils::Timer::timeFromStartPoint. Call it in the beginning of the code that you want to measure.
double arl::utils::Timer::timeElapsedSinceLastCall | ( | ) |
Returns the time elapsed in seconds since the last call of this function. Useful in control loops, to know how much time elapsed since the previous control cycle.
double arl::utils::Timer::timeFromGivenPoint | ( | const std::chrono::steady_clock::time_point & | given_point | ) |
Provides the time elapsed in seconds from a given point. The given point can be obtained if you first call arl::utils::Timer::getCurrPoint.
given_point | The given time point. |
double arl::utils::Timer::timeFromStartPoint | ( | ) |
Provides the time elapsed in seconds from the last call of arl::utils::Timer::startPoint.