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)

Arguments

seconds

A count of the start time in seconds.

start

A flag indicating whether to start the timer.

x

A dtt_timer object.

Value

A dtt_timer

Functions

  • dtt_start: Start

  • dtt_stop: Stop

  • dtt_elapsed: Elapsed Duration

  • dtt_reset: Reset

  • dtt_is_running: Is Running

Examples

# 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)
#> 0s
dtt_elapsed(t)
#> 0s
# stop the timer t <- dtt_stop(t) # time elapsed is now fixed dtt_elapsed(t)
#> 0s
dtt_elapsed(t)
#> 0s
# reset the timer t <- dtt_reset(t) dtt_elapsed(t)
#> 0s