dtt_timer: Use a dtt_timer

Description Usage Arguments Value Functions Examples

View source: R/timer.R

Description

Use a dtt_timer

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# create a new timer
t <- dtt_timer()

# no time has elapsed because the timer has not started
dtt_elapsed(t)

# start the timer
t <- dtt_start(t)

# get the time elapsed
# time elapsed is increasing because the timer is still running
dtt_elapsed(t)
dtt_elapsed(t)

# stop the timer
t <- dtt_stop(t)

# time elapsed is now fixed
dtt_elapsed(t)
dtt_elapsed(t)

# reset the timer
t <- dtt_reset(t)
dtt_elapsed(t)

poissonconsulting/dttr documentation built on Feb. 20, 2021, 12:18 a.m.