Skip to content

Difference in time should use difftime not subtraction #142

@HughParsonage

Description

@HughParsonage

td <- abs(Sys.time() - t0)

This gives the wrong result for some durations

cat(tinytest:::humanize(abs(Sys.time() - (Sys.time() - 60 * 4.1))))
#> 4.1s

cat(tinytest:::humanize(difftime(Sys.time(), Sys.time() - 60 * 4.1, units = "secs")))
#> 4m 6.0s

(The abs should be removed too.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions