When the method takes more the 60 seconds, the units of the duration field change from seconds to minutes, courtesy of the default difftime function. For example:
start <- Sys.time() - 61
end <- Sys.time()
print(start)
# "2022-04-29 15:22:52 CEST"
print(end)
# "2022-04-29 15:23:53 CEST"
duration <- end - start
cat("Method run completed (", as.numeric(round(duration, 4)), " sec)", sep = "")
# Method run completed (1.0194 sec)
I think it's better to just use the same unit everywhere, e.g.:
duration <- difftime(end, start, units = "secs")
cat("Method run completed (", as.numeric(round(duration, 4)), " sec)", sep = "")
# Method run completed (61.1642 sec)
This applies to other classes that have duration fields as well.
The
duration
field of theMethod
class is determined based onhttps://github.com/mihaiconstantin/powerly/blob/d6be4e671a391c2614a919135e4e0292fe2cd381/R/Method.R#L172-L179
as
https://github.com/mihaiconstantin/powerly/blob/d6be4e671a391c2614a919135e4e0292fe2cd381/R/Method.R#L184-L185
and then reported in the summary as follows:
https://github.com/mihaiconstantin/powerly/blob/d6be4e671a391c2614a919135e4e0292fe2cd381/R/Method.R#L210-L211
When the method takes more the 60 seconds, the units of the
duration
field change from seconds to minutes, courtesy of the defaultdifftime
function. For example:I think it's better to just use the same unit everywhere, e.g.:
This applies to other classes that have
duration
fields as well.