Stopwatch that can be stopped and resumed, based on a steady clock.
More...
#include <RST/time/Timer.hpp>
|
| using | Clock = std::chrono::steady_clock |
| |
| using | Duration = Clock::duration |
| |
|
| | Timer () noexcept=default |
| |
| void | start () noexcept |
| | Starts from zero.
|
| |
| void | stop () noexcept |
| | Pauses, keeping the elapsed time.
|
| |
| void | resume () noexcept |
| | Continues after stop().
|
| |
| void | reset () noexcept |
| | Stops and clears the elapsed time.
|
| |
| Duration | restart () noexcept |
| | Returns the elapsed time and starts again from zero.
|
| |
| bool | isRunning () const noexcept |
| |
| Duration | elapsed () const noexcept |
| | Total running time.
|
| |
| template<typename T = double> |
| T | getElapsedSeconds () const noexcept |
| | Elapsed time in seconds; the Ms, Us and Ns variants use milli-, micro- and nanoseconds.
|
| |
| template<typename T = double> |
| T | getElapsedMs () const noexcept |
| |
| template<typename T = double> |
| T | getElapsedUs () const noexcept |
| |
| template<typename T = double> |
| T | getElapsedNs () const noexcept |
| |
Stopwatch that can be stopped and resumed, based on a steady clock.
- Examples
- system.cpp.
◆ Clock
◆ Duration
◆ Timer()
| RST::Time::Timer::Timer |
( |
| ) |
|
|
defaultnoexcept |
◆ startNew()
| static Timer RST::Time::Timer::startNew |
( |
| ) |
|
|
inlinestaticnoexcept |
◆ start()
| void RST::Time::Timer::start |
( |
| ) |
|
|
inlinenoexcept |
◆ stop()
| void RST::Time::Timer::stop |
( |
| ) |
|
|
inlinenoexcept |
Pauses, keeping the elapsed time.
◆ resume()
| void RST::Time::Timer::resume |
( |
| ) |
|
|
inlinenoexcept |
◆ reset()
| void RST::Time::Timer::reset |
( |
| ) |
|
|
inlinenoexcept |
Stops and clears the elapsed time.
◆ restart()
Returns the elapsed time and starts again from zero.
◆ isRunning()
| bool RST::Time::Timer::isRunning |
( |
| ) |
const |
|
inlinenoexcept |
◆ elapsed()
| Duration RST::Time::Timer::elapsed |
( |
| ) |
const |
|
inlinenoexcept |
◆ getElapsedSeconds()
template<typename T = double>
| T RST::Time::Timer::getElapsedSeconds |
( |
| ) |
const |
|
inlinenoexcept |
Elapsed time in seconds; the Ms, Us and Ns variants use milli-, micro- and nanoseconds.
◆ getElapsedMs()
template<typename T = double>
| T RST::Time::Timer::getElapsedMs |
( |
| ) |
const |
|
inlinenoexcept |
◆ getElapsedUs()
template<typename T = double>
| T RST::Time::Timer::getElapsedUs |
( |
| ) |
const |
|
inlinenoexcept |
◆ getElapsedNs()
template<typename T = double>
| T RST::Time::Timer::getElapsedNs |
( |
| ) |
const |
|
inlinenoexcept |
The documentation for this class was generated from the following file: