Skip to contents

Pretty formatting of milliseconds

Usage

pretty_ms(ms, compact = FALSE)

Arguments

ms

Numeric vector of milliseconds

compact

If true, then only the first non-zero unit is used. See examples below.

Value

Character vector of formatted time intervals.

See also

Other time: pretty_dt(), pretty_sec()

Examples

pretty_ms(c(1337, 13370, 133700, 1337000, 1337000000))
#> [1] "1.3s"            "13.4s"           "2m 13.7s"        "22m 17s"        
#> [5] "15d 11h 23m 20s"

pretty_ms(c(1337, 13370, 133700, 1337000, 1337000000),
          compact = TRUE)
#> [1] "~1.3s"  "~13.4s" "~2m"    "~22m"   "~15d"