Class cxxtimer::Timer
-
class Timer
This class works as a stopwatch.
Public Functions
-
inline Timer(bool start = false)
Constructor.
- Parameters:
start – If true, the timer is started just after construction. Otherwise, it will not be automatically started.
-
Timer(Timer &&other) = default
Transfer constructor.
- Parameters:
other – The object to be transfered.
-
virtual ~Timer() = default
Destructor.
-
Timer &operator=(const Timer &other) = default
Assignment operator by copy.
- Parameters:
other – The object to be copied.
- Returns:
A reference to this object.
-
Timer &operator=(Timer &&other) = default
Assignment operator by transfer.
- Parameters:
other – The object to be transferred.
- Returns:
A reference to this object.
-
inline void start()
Start/resume the timer.
-
inline void stop()
Stop/pause the timer.
-
inline void reset()
Reset the timer.
-
template<class duration_t = std::chrono::milliseconds>
duration_t::rep count() const Return the elapsed time.
- Parameters:
duration_t – The duration type used to return the time elapsed. If not specified, it returns the time as represented by std::chrono::milliseconds.
- Returns:
The elapsed time.
-
inline Timer(bool start = false)