subtract POSIXt class objects and return value in HH:MM:SS format.

hms_span(start, end)

Arguments

start

old Sys.time()

end

new Sys.time()

Value

subtracted time in hh:mm:ss format

Details

source: https://stackoverflow.com/questions/32100133/print-the-time-a-script-has-been-running-in-r answer by nrussell