Class Stopwatch
Defined in File stopwatch.h
Class Documentation
-
class Stopwatch
A simple utility class for measuring elapsed time across episodes.
The
Stopwatch
class allows tracking the duration of multiple timed episodes. It provides functionality to start, stop, and retrieve timing information for the last episode as well as the total duration of all episodes.Public Functions
-
void start()
Starts the stopwatch for a new timing episode.
Records the start time for the current episode. If the stopwatch is already running, calling
start()
has no effect.
-
void stop()
Stops the stopwatch for the current timing episode.
Records the end time for the current episode and updates the total accumulated duration. If the stopwatch is not running, calling
stop()
has no effect.
-
inline bool isRunning() const
Checks if the stopwatch is currently running.
- Returns:
true
if the stopwatch is running,false
otherwise.
-
inline double getLastEpisodeDuration() const
Gets the duration of the last timing episode.
The value represents the time elapsed during the most recently completed pair of
start()
andstop()
calls. If no episode has been completed, this returns 0.- Returns:
The duration of the last episode in seconds as a
double
.
-
void start()