< prev index next >

src/java.base/share/classes/java/time/Duration.java

Print this page

        

*** 1368,1377 **** --- 1368,1378 ---- * * @param unit the unit to truncate to, not null * @return a {@code Duration} based on this duration with the time truncated, not null * @throws DateTimeException if the unit is invalid for truncation * @throws UnsupportedTemporalTypeException if the unit is not supported + * @since 9 */ public Duration truncatedTo(TemporalUnit unit) { Objects.requireNonNull(unit, "unit"); if (unit == ChronoUnit.SECONDS && (seconds >= 0 || nanos == 0)) { return new Duration(seconds, 0);
< prev index next >