Timer¶
| Spice | |
|---|---|
Timer struct¶
High resolution timer
Constructors¶
ctor¶
| Spice | |
|---|---|
Construct a timer
Parameters
| Name | Type | Description |
|---|---|---|
mode |
TimerMode |
Unit the timer reports durations in (default: TimerMode::MILLIS) |
timerOutput |
unsigned long* |
Optional pointer accumulating the measured duration across pause cycles (default: nil<unsigned long*>) |
Methods¶
start¶
| Spice | |
|---|---|
Start the timer, resetting any accumulated output
stop¶
| Spice | |
|---|---|
Stop the timer
pause¶
| Spice | |
|---|---|
Pause the timer, adding the elapsed duration to the optional output pointer
resume¶
| Spice | |
|---|---|
Resume the timer, restarting the measurement from the current time
getDurationInMicros¶
| Spice | |
|---|---|
Retrieve the measured duration in microseconds
Returns: unsigned long — Duration in microseconds
getDurationInMillis¶
| Spice | |
|---|---|
Retrieve the measured duration in milliseconds
Returns: unsigned long — Duration in milliseconds
getDurationInSeconds¶
| Spice | |
|---|---|
Retrieve the measured duration in seconds
Returns: double — Duration in seconds
getDurationInMinutes¶
| Spice | |
|---|---|
Retrieve the measured duration in minutes
Returns: double — Duration in minutes
getDuration¶
| Spice | |
|---|---|
Retrieve the measured duration in the timer's configured mode
Returns: unsigned long — Duration in the configured unit
TimerMode enum¶
Unit in which a Timer reports its measured durations
| Item | Value | Description |
|---|---|---|
MICROS |
||
MILLIS |
||
SECONDS |
||
MINUTES |