libzed 1.9.9
A general-purpose library for quick and simple data manipulation.
 
Loading...
Searching...
No Matches
z::core::timer Class Reference

A class for easily managing timers. More...

#include <timer.hpp>

Inheritance diagram for z::core::timer:
z::core::timeout

Public Member Functions

 timer (bool run=true) noexcept
 Timer constructor.
 
void reset () noexcept
 Reset the timer.
 
void reset (std::chrono::high_resolution_clock::time_point time) noexcept
 reset the timer to a specific point in time.
 
unsigned int micros () const noexcept
 Get the elapsed time in microseconds.
 
unsigned int millis () const noexcept
 Get the elapsed time in milliseconds.
 
unsigned int seconds () const noexcept
 Get the elapsed time in seconds.
 
unsigned int minutes () const noexcept
 Get the elapsed time in minutes.
 
unsigned int hours () const noexcept
 Get the elapsed time in minutes.
 
template<class Archive >
void save (Archive &ar) const
 Serialization output.
 
template<class Archive >
void load (Archive &ar)
 Serialization input.
 

Detailed Description

A class for easily managing timers.

Because this class uses the chrono library, it requires at least C++11.

Constructor & Destructor Documentation

◆ timer()

z::core::timer::timer ( bool  run = true)
noexcept

Timer constructor.

Parameters
runan optional parameter to decide whether the timer should start now.

Member Function Documentation

◆ hours()

unsigned int z::core::timer::hours ( ) const
noexcept

Get the elapsed time in minutes.

Returns
The number of minutes that have passed since the timer was last reset.

◆ load()

template<class Archive >
void z::core::timer::load ( Archive ar)
inline

Serialization input.

Parameters
arThe input archive.

◆ micros()

unsigned int z::core::timer::micros ( ) const
noexcept

Get the elapsed time in microseconds.

Returns
The number of microseconds that have passed since the timer was last reset.

◆ millis()

unsigned int z::core::timer::millis ( ) const
noexcept

Get the elapsed time in milliseconds.

Returns
The number of milliseconds that have passed since the timer was last reset.

◆ minutes()

unsigned int z::core::timer::minutes ( ) const
noexcept

Get the elapsed time in minutes.

Returns
The number of minutes that have passed since the timer was last reset.

◆ save()

template<class Archive >
void z::core::timer::save ( Archive ar) const
inline

Serialization output.

Parameters
arThe output archive.

◆ seconds()

unsigned int z::core::timer::seconds ( ) const
noexcept

Get the elapsed time in seconds.

Returns
The number of seconds that have passed since the timer was last reset.

The documentation for this class was generated from the following file: