< prev index next >

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

Print this page

        

*** 1192,1201 **** --- 1192,1202 ---- * This returns the total number of whole seconds in the duration. * <p> * This instance is immutable and unaffected by this method call. * * @return the whole seconds part of the length of the duration, positive or negative + * @since 9 */ public long toSeconds() { return seconds; }
*** 1241,1250 **** --- 1242,1252 ---- * This is based on the standard definition of a day as 24 hours. * <p> * This instance is immutable and unaffected by this method call. * * @return the number of days in the duration, may be negative + * @since 9 */ public long toDaysPart(){ return seconds / SECONDS_PER_DAY; }
*** 1256,1265 **** --- 1258,1268 ---- * This is based on the standard definition of a day as 24 hours. * <p> * This instance is immutable and unaffected by this method call. * * @return the number of hours part in the duration, may be negative + * @since 9 */ public int toHoursPart(){ return (int) (toHours() % 24); }
*** 1271,1281 **** * This is based on the standard definition of an hour as 60 minutes. * <p> * This instance is immutable and unaffected by this method call. * * @return the number of minutes parts in the duration, may be negative ! * may be negative */ public int toMinutesPart(){ return (int) (toMinutes() % MINUTES_PER_HOUR); } --- 1274,1284 ---- * This is based on the standard definition of an hour as 60 minutes. * <p> * This instance is immutable and unaffected by this method call. * * @return the number of minutes parts in the duration, may be negative ! * @since 9 */ public int toMinutesPart(){ return (int) (toMinutes() % MINUTES_PER_HOUR); }
*** 1287,1296 **** --- 1290,1300 ---- * This is based on the standard definition of a minute as 60 seconds. * <p> * This instance is immutable and unaffected by this method call. * * @return the number of seconds parts in the duration, may be negative + * @since 9 */ public int toSecondsPart(){ return (int) (seconds % SECONDS_PER_MINUTE); }
*** 1304,1313 **** --- 1308,1318 ---- * The total duration is defined by calling {@link #getNano()} and {@link #getSeconds()}. * <p> * This instance is immutable and unaffected by this method call. * * @return the number of milliseconds part of the duration. + * @since 9 */ public int toMillisPart(){ return nanos / 1000_000; }
*** 1320,1329 **** --- 1325,1335 ---- * The total duration is defined by calling {@link #getNano()} and {@link #getSeconds()}. * <p> * This instance is immutable and unaffected by this method call. * * @return the nanoseconds within the second part of the length of the duration, from 0 to 999,999,999 + * @since 9 */ public int toNanosPart(){ return nanos; }
< prev index next >