dt2str: Convert time difference to string.

Description Usage Arguments Value Note Author(s) Examples

Description

Convert time difference in seconds to string depending on switch.

Usage

1
  dt2str(dt,dec=0,verbose=FALSE)

Arguments

dt

Time difference in seconds

dec

Places in decimal fraction of seconds

verbose

If TRUE, then delimited by "hours minutes seconds", else by ":"

Value

String representing the time difference, with dec decimals in seconds.

Note

Enclosing the above statements in a function is likely to show zero time.

Author(s)

Christian W. Hoffmann <christian@echoffmann.ch>

Examples

1
2
3
4
  t1 <- unclass(Sys.time())
  x <- 0;  for (i in 1:1.e6) x <- x+1
  t2 <- unclass(Sys.time())
  dt2str(t2-t1,3) # 00:00:0.070, Macbook Pro 2016, 2.2 GHz, 16GB RAM

cwhmisc documentation built on May 1, 2019, 7:55 p.m.