A clock that can be used to measure time.
More...
#include <C_clock.hpp>
|
| 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.
|
|
A clock that can be used to measure time.
This class use std::chrono::steady_clock to measure time.
◆ Clock()
Default constructor.
When a clock is created, it set his time point to the current time.
◆ 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
-
TD | The 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
-
duration | The 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
-
TD | The 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: