⏱️ golxzn::os::chrono ⏱️ 1.2.4
Chrono for golxzn's projects.
Loading...
Searching...
No Matches
golxzn::os::chrono::fast_clock< BaseClock > Class Template Reference

Class that represents fast clock, which store only one time point.This class allows to measure time since last call of elapsed() or since construction. It's fast because it doesn't store any information but last time point This class provides measurement of elapsed time since last call of elapsed() or since construction.

‍It doesn't store any information but last time point. When you call elapsed(), it stores new time point, and returns difference of old and new time points.

More...

#include <clock.hpp>

Public Types

using base_clock = BaseClock
 Base clock type.
 
using time_point = typename base_clock::time_point
 Time point type from base clock.
 

Public Member Functions

time elapsed () noexcept
 Returns elapsed time since last call of elapsed() or since construction.
 

Static Public Attributes

static constexpr time_point zero {}
 Zero time point.
 

Detailed Description

template<class BaseClock = utils::default_base_clock>
class golxzn::os::chrono::fast_clock< BaseClock >

Class that represents fast clock, which store only one time point.

This class allows to measure time since last call of elapsed() or since construction. It's fast because it doesn't store any information but last time point This class provides measurement of elapsed time since last call of elapsed() or since construction.

‍It doesn't store any information but last time point. When you call elapsed(), it stores new time point, and returns difference of old and new time points.

Template Parameters
BaseClockclock that will be used for measurement. It has to be monotonic and STL compatible.

Usage:

while (game_running) {
const auto elapsed{ clock.elapsed() };
Game::Update(elapsed.seconds<double>());
...
}
Class that represents clock.In comparison with golxzn::os::chrono::fast_clock, it provides more funct...
Definition clock.hpp:68
time elapsed() const noexcept
Returns elapsed time since last reset or construction.
Class that represents fast clock, which store only one time point.This class allows to measure time s...
Definition clock.hpp:39
time elapsed() noexcept
Returns elapsed time since last call of elapsed() or since construction.
constexpr utils::floating_point_t< T > seconds() const noexcept
Returns duration in seconds.
See also
golxzn::os::chrono::clock

Member Function Documentation

◆ elapsed()

template<class BaseClock = utils::default_base_clock>
time golxzn::os::chrono::fast_clock< BaseClock >::elapsed ( )
noexcept

Returns elapsed time since last call of elapsed() or since construction.

Returns
time

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