Module stopwatch

Module stopwatch 

Source
Expand description

§Stopwatch

A stopwatch that mimics iOS’s stopwatch.

§Usage

  • Use Stopwatch::new() to initialise a new stopwatch instance. The stopwatch is paused at 00:00 and will not run until you call .resume() or .pause_or_resume().
  • While running:
    • Call .lap() to record lap times.
    • Call .pause_or_resume(), .pause() or .resume() to pause or resume.
  • When you want to stop (reset), call .stop(), which resets the stopwatch and returns StopwatchData

§Examples

§Schematic

                 lap    lap          lap
start       start |      |     start  |
  o--------x   o-----------x      o-----------x
         pause           pause            pause(end)

Structs§

Stopwatch
StopwatchData
The data returned by Stopwatch upon .stopping (i.e. resetting)