Class Stopwatch
Stopwatch (French: chronomètre) to measure elapsed time.
Sections
Section | Summary |
---|---|
Debug | Debugg and log functions. |
Durations | Clock and durations utility functions
|
Summary
Return type | Function and summary |
---|---|
Stopwatch | new() Instantiate and start a stopwatch |
reset() Reset the stopwatch to zero. | |
string | string(boolean exact, boolean clockFormat) Return elapsed time as formatted string. |
number | time() Return the elapsed time since stopwatch instantiation or last reset. |
Methods
Stopwatch:reset()
Reset the stopwatch to zero.
Stopwatch:time()
Return the elapsed time since stopwatch instantiation or last reset.
- Return
- number: Elapsed time in milliseconds.
Stopwatch:string(boolean exact, boolean clockFormat)
Return elapsed time as formatted string.
Parameter | Type | Default | Description |
---|---|---|---|
exact | boolean | false | If false, removes details (e.g. no milliseconds if time is minutes and you don't need so much precision). |
clockFormat | boolean | false | Clock format: returns 00:03.010 instead of 3s 10ms |
- Return
- string: "10 ms", "3 s 456 ms", "1 min 14 s", 00:03.010...
- See
- string_time