Convenience functions to round or truncate to a multiple of seconds.
Arguments
- x
A vector of class hms
- secs
Multiple of seconds, a positive numeric. Values less than one are supported
- digits
Number of digits, a whole number. Negative numbers are supported.
Examples
round_hms(as_hms("12:34:56"), 5)
#> 12:34:55
round_hms(as_hms("12:34:56"), 60)
#> 12:35:00
round_hms(as_hms("12:34:56.78"), 0.25)
#> 12:34:56.75
round_hms(as_hms("12:34:56.78"), digits = 1)
#> 12:34:56.8
round_hms(as_hms("12:34:56.78"), digits = -2)
#> 12:35:00
trunc_hms(as_hms("12:34:56"), 60)
#> 12:34:00