Stopwatch Class
A high-resolution timer based on std::chrono::steady_clock. More...
Declaration
Public Constructors Index
| Stopwatch () noexcept=default | |
|
Constructs and starts the stopwatch. More... | |
Public Member Functions Index
| void | start () noexcept |
|
Starts (or restarts) the timer. Captures the current timestamp. More... | |
| float | elapsedMs () const noexcept |
| float | elapsedSeconds () const noexcept |
|
Returns the time elapsed in seconds. More... | |
Private Member Attributes Index
| std::chrono::time_point< std::chrono::steady_clock > | start_ {std::chrono::steady_clock::now()} |
Description
A high-resolution timer based on std::chrono::steady_clock.
Used to measure elapsed time intervals with the highest precision provided by the OS (suitable for frame time measurements and profiling).
Definition at line 20 of file Stopwatch.ixx.
Public Constructors
Stopwatch()
| noexcept default |
Constructs and starts the stopwatch.
The stopwatch is initialized to the current time so queries are well-defined immediately after construction.
Definition at line 33 of file Stopwatch.ixx.
Public Member Functions
elapsedMs()
| inline nodiscard noexcept |
Returns the time elapsed since start() was called.
- Returns
The elapsed time in milliseconds as a floating point value.
Definition at line 48 of file Stopwatch.ixx.
elapsedSeconds()
| inline nodiscard noexcept |
Returns the time elapsed in seconds.
- Returns
The elapsed time in seconds as a floating point value.
Definition at line 60 of file Stopwatch.ixx.
start()
Private Member Attributes
start_
|
Definition at line 24 of file Stopwatch.ixx.
The documentation for this class was generated from the following file:
Generated via doxygen2docusaurus 2.0.0 by Doxygen 1.15.0.