Sparkle 0.0.1
Loading...
Searching...
No Matches
spk::Chronometer Class Reference

Monotonic stopwatch tracking elapsed duration with start/pause/resume controls. More...

#include <spk_chronometer.hpp>

Collaboration diagram for spk::Chronometer:
Collaboration graph

Public Types

enum class  State { Idle , Running , Paused }
 States representing the current stopwatch lifecycle.

Public Member Functions

 Chronometer ()
 Builds a chronometer in the idle state with zeroed counters.
void start ()
 Starts measuring time if idle or resets accumulation after stop.
void stop ()
 Stops the chronometer and resets accumulated duration.
void pause ()
 Pauses ongoing measurement without clearing accumulated time.
void resume ()
 Resumes measurement after a pause.
void restart ()
 Convenience to stop and immediately start a new measurement.
Duration elapsedTime () const
 Returns the total measured duration including paused segments.
State state () const
 Retrieves the current state of the chronometer.

Detailed Description

Monotonic stopwatch tracking elapsed duration with start/pause/resume controls.

chrono.start();
// ... work ...
chrono.pause();
auto elapsed = chrono.elapsedTime();
Monotonic stopwatch tracking elapsed duration with start/pause/resume controls.
Definition spk_chronometer.hpp:23
void pause()
Pauses ongoing measurement without clearing accumulated time.
Definition spk_chronometer.cpp:30
Duration elapsedTime() const
Returns the total measured duration including paused segments.
Definition spk_chronometer.cpp:55
void start()
Starts measuring time if idle or resets accumulation after stop.
Definition spk_chronometer.cpp:14

Member Function Documentation

◆ elapsedTime()

Duration spk::Chronometer::elapsedTime ( ) const

Returns the total measured duration including paused segments.

Returns
Accumulated duration since the last start.

◆ state()

State spk::Chronometer::state ( ) const
inline

Retrieves the current state of the chronometer.

Returns
Current lifecycle state.

The documentation for this class was generated from the following files:
  • includes/structure/system/time/spk_chronometer.hpp
  • srcs/structure/system/time/spk_chronometer.cpp