obtain duration in dd:hh:mm:sec format

get_duration(duration, message = "duration")

Arguments

duration

difftime object

message

message to display before the duration (default: duration)

Value

Examples

start_time <- Sys.time() Sys.sleep(1) get_duration(Sys.time() - start_time)
#> duration: 00:00:00:1.006
get_duration(as.difftime(1, units = 'secs'))
#> duration: 00:00:00:1.000
get_duration(as.difftime(1, units = 'mins'))
#> duration: 00:00:01:0.000
get_duration(as.difftime(1, units = 'hours'))
#> duration: 00:01:00:0.000
get_duration(as.difftime(1, units = 'days'))
#> duration: 01:00:00:0.000
get_duration(as.difftime(1.5251, units = 'days'), message = 'test')
#> test: 01:12:36:8.640