Aegis2D
Modular C++26 2D game engine for networked games
Loading...
Searching...
No Matches
aegis2d::core::Stopwatch Class Reference

Measures elapsed time with the monotonic std::chrono::steady_clock. More...

#include <aegis2d/core/clock.hpp>

Public Types

using Clock = std::chrono::steady_clock
 Clock the stopwatch reads; it never goes backwards.
 

Public Member Functions

 Stopwatch () noexcept
 Starts measuring from now.
 
Duration elapsed () const noexcept
 Time since construction or the last restart().
 
Duration restart () noexcept
 Starts measuring again from now.
 

Detailed Description

Measures elapsed time with the monotonic std::chrono::steady_clock.

Member Typedef Documentation

◆ Clock

using aegis2d::core::Stopwatch::Clock = std::chrono::steady_clock

Clock the stopwatch reads; it never goes backwards.

Constructor & Destructor Documentation

◆ Stopwatch()

aegis2d::core::Stopwatch::Stopwatch ( )
noexcept

Starts measuring from now.

Member Function Documentation

◆ elapsed()

Duration aegis2d::core::Stopwatch::elapsed ( ) const
noexcept

Time since construction or the last restart().

Returns
The elapsed time.

◆ restart()

Duration aegis2d::core::Stopwatch::restart ( )
noexcept

Starts measuring again from now.

Returns
The time elapsed before the restart, i.e. the duration of the last frame.

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