VIPRA Documentation
Loading...
Searching...
No Matches
VIPRA::Util::Clock< time_t, clock_t > Class Template Reference

Clock to time execution time. More...

#include <clock.hpp>

Public Member Functions

auto now () noexcept -> time_t
 Returns the current time.
 
void start () noexcept
 Starts the timer.
 
auto is_running () const noexcept -> bool
 
void pause () noexcept
 Pauses the timer on the clock.
 
void resume () noexcept
 Continues the timer after pausing.
 
auto running_time () noexcept -> time_t
 Returns the total accumulated time on the clock.
 
auto stop () noexcept -> time_t
 Resets the clock, Returns the time since it was started.
 

Static Public Attributes

static constexpr time_t ZERO = time_t::zero()
 

Detailed Description

template<typename time_t = seconds, typename clock_t = std::chrono::steady_clock>
class VIPRA::Util::Clock< time_t, clock_t >

Clock to time execution time.

Template Parameters
time_t: time scale
clock_t: type of clock to use

Member Function Documentation

◆ now()

template<typename time_t = seconds, typename clock_t = std::chrono::steady_clock>
auto VIPRA::Util::Clock< time_t, clock_t >::now ( ) -> time_t
inlinenodiscardnoexcept

Returns the current time.

Returns
time_t

◆ running_time()

template<typename time_t = seconds, typename clock_t = std::chrono::steady_clock>
auto VIPRA::Util::Clock< time_t, clock_t >::running_time ( ) -> time_t
inlinenodiscardnoexcept

Returns the total accumulated time on the clock.

Returns
time_t

◆ stop()

template<typename time_t = seconds, typename clock_t = std::chrono::steady_clock>
auto VIPRA::Util::Clock< time_t, clock_t >::stop ( ) -> time_t
inlinenoexcept

Resets the clock, Returns the time since it was started.

Returns
time_t

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