FastEngine 0.9.3
A multiplayer oriented 2D engine made with Vulkan.
Loading...
Searching...
No Matches
fge::Clock Class Reference

A clock that can be used to measure time. More...

#include <C_clock.hpp>

Public Member Functions

 Clock ()
 Default constructor.
 
auto getElapsedTime () const
 Get the time elapsed since the last time point.
 
template<typename TD >
auto getElapsedTime () const
 Get the time elapsed since the last time point with duration cast to the given type.
 
auto restart ()
 Restart the clock and return the time elapsed since the last time point.
 
template<typename TD >
auto restart ()
 Restart the clock and return the time elapsed since the last time point with duration cast to the given type.
 
bool reached (std::chrono::milliseconds const &duration)
 Check if the clock has elapsed the given duration.
 

Detailed Description

A clock that can be used to measure time.

This class use std::chrono::steady_clock to measure time.

Constructor & Destructor Documentation

◆ Clock()

fge::Clock::Clock ( )
inline

Default constructor.

When a clock is created, it set his time point to the current time.

Member Function Documentation

◆ getElapsedTime() [1/2]

auto fge::Clock::getElapsedTime ( ) const
inline

Get the time elapsed since the last time point.

Returns
The time elapsed since the last time point

◆ getElapsedTime() [2/2]

template<typename TD >
auto fge::Clock::getElapsedTime ( ) const
inline

Get the time elapsed since the last time point with duration cast to the given type.

Template Parameters
TDThe type of the chrono duration
Returns
The time elapsed since the last time point casted to the given type

◆ reached()

bool fge::Clock::reached ( std::chrono::milliseconds const & duration)
inline

Check if the clock has elapsed the given duration.

Parameters
durationThe chrono duration to check
Returns
True if the clock has elapsed the given duration, false otherwise

◆ restart() [1/2]

auto fge::Clock::restart ( )
inline

Restart the clock and return the time elapsed since the last time point.

By restarting the clock, the time point is reset to the current time.

Returns
The time elapsed since the last time point

◆ restart() [2/2]

template<typename TD >
auto fge::Clock::restart ( )
inline

Restart the clock and return the time elapsed since the last time point with duration cast to the given type.

By restarting the clock, the time point is reset to the current time.

Template Parameters
TDThe type of the chrono duration
Returns
The time elapsed since the last time point casted to the given type

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