Class to instanciate timers and measure durations between their starts and stops.
#include <tools/Timer.hpp>
◆ Timer()
openfluid::tools::Timer::Timer |
( |
bool |
AutoStart = false | ) |
|
|
inline |
Constructs a timer (not started by default)
- Parameters
-
[in] | AutoStart | If true, the timer is automatically started when it is instanciated (false by default) |
◆ elapsed()
long int openfluid::tools::Timer::elapsed |
( |
| ) |
|
|
inline |
Returns the duration of the timer in milliseconds. If the timer is stopped, it returns the duration between start and stop. If the timer is running, it returns the duration between start and the call of the elapsed() method.
- Returns
- True if timer is running
◆ elapsedAsPrettyString()
std::string openfluid::tools::Timer::elapsedAsPrettyString |
( |
| ) |
|
|
inline |
Returns the elapsed time as a pretty string representing days, hours, minutes and decimal seconds.
- Returns
- the converted duration as a string
◆ getDurationAsPrettyString()
static std::string openfluid::tools::Timer::getDurationAsPrettyString |
( |
long int |
MSecsDuration | ) |
|
|
inlinestatic |
Returns the given duration as a pretty string representing days, hours, minutes and decimal seconds.
- Parameters
-
[in] | MSecsDuration | the duration in milliseconds |
- Returns
- the converted duration as a string
◆ isRunning()
bool openfluid::tools::Timer::isRunning |
( |
| ) |
|
|
inline |
Returns true if the timer is currently running
- Returns
- True if timer is running
◆ reset()
void openfluid::tools::Timer::reset |
( |
| ) |
|
|
inline |
Stops and resets the timer. If the timer is currently running, the elapsed time is lost
◆ restart()
void openfluid::tools::Timer::restart |
( |
| ) |
|
|
inline |
Restarts the timer (even if currently running)
◆ splitDuration()
static void openfluid::tools::Timer::splitDuration |
( |
long int |
MSecsDuration, |
|
|
int & |
Days, |
|
|
int & |
Hours, |
|
|
int & |
Minutes, |
|
|
int & |
Seconds, |
|
|
int & |
MSecs |
|
) |
| |
|
inlinestatic |
Splits the given duration in milliseconds into days, hours, minutes, seconds and milliseconds.
- Parameters
-
[in] | MSecsDuration | the duration in milliseconds |
[out] | Days | the number of days |
[out] | Hours | the number of hours |
[out] | Minutes | the number of minutes |
[out] | Seconds | the number of seconds |
[out] | MSecs | the number of milliseconds |
◆ start()
void openfluid::tools::Timer::start |
( |
| ) |
|
|
inline |
Starts the timer (if not currently running)
◆ stop()
void openfluid::tools::Timer::stop |
( |
| ) |
|
|
inline |
Stops the timer (if currently running)
The documentation for this class was generated from the following file: