Use a dtt_timer
dtt_timer(seconds = 0L, start = FALSE) dtt_start(x) dtt_stop(x) dtt_elapsed(x) dtt_reset(x, seconds = 0L, start = FALSE) dtt_is_running(x)
| seconds | A count of the start time in seconds. |
|---|---|
| start | A flag indicating whether to start the timer. |
| x | A dtt_timer object. |
A dtt_timer
dtt_start: Start
dtt_stop: Stop
dtt_elapsed: Elapsed Duration
dtt_reset: Reset
dtt_is_running: Is Running
# create a new timer t <- dtt_timer() # no time has elapsed because the timer has not started dtt_elapsed(t)#> 0s# start the timer t <- dtt_start(t) # get the time elapsed # time elapsed is increasing because the timer is still running dtt_elapsed(t)#> 0sdtt_elapsed(t)#> 0s# stop the timer t <- dtt_stop(t) # time elapsed is now fixed dtt_elapsed(t)#> 0sdtt_elapsed(t)#> 0s# reset the timer t <- dtt_reset(t) dtt_elapsed(t)#> 0s