duration.round
duration: Y = round (D)
duration: Y = round (D, unit)
Round to the nearest integer time unit for duration arrays.
Y = round (D) rounds each element of the duration
array D to the nearest integer number of seconds to that element.
In case of a tie, return the one further away from zero.
Y = round (D, unit) rounds each element of the
duration array D to the nearest integer number of the specified
unit of time to that element. unit must be one of the following
values:
'seconds' (default)
'minutes'
'hours'
'days'
'years'
Source Code: duration
round rounds a duration. With no unit it rounds to the nearest second; pass a unit to round to whole hours, minutes, and so on.
d = hours (2.4)
d = duration 2.4 hr
round (d, 'hours')
ans = duration 2 hr
Default (nearest second):
round (seconds (90.7))
ans = duration 91 sec