[][src]Module clock_core::stopwatch

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 data

Examples

Schematic

This example is not tested
                 lap    lap          lap
start       start |      |     start  |
  o--------x   o-----------x      o-----------x
         pause           pause            pause(end)

Structs

StopWatchData
Stopwatch