public int getValue(long duration, long instant) { return FieldUtils.safeToInt(duration); }
public int getValue(long duration) { return FieldUtils.safeToInt(duration); }
public int getValue(long duration) { return FieldUtils.safeToInt(duration); }
public int getValue(long duration, long instant) { return FieldUtils.safeToInt(duration); }
/** * Multiply two values to return an int throwing an exception if overflow occurs. * * @param val1 the first value * @param val2 the second value * @return the new total * @throws ArithmeticException if the value is too big or too small */ public static int safeMultiplyToInt(long val1, long val2) { long val = FieldUtils.safeMultiply(val1, val2); return FieldUtils.safeToInt(val); }
/** * Get the value of this field from the milliseconds, which is approximate * if this field is imprecise. * * @param duration the milliseconds to query, which may be negative * @return the value of the field, in the units of the field, which may be * negative */ public int getValue(long duration) { return FieldUtils.safeToInt(getValueAsLong(duration)); }
/** * Get the value of this field from the milliseconds, which is approximate * if this field is imprecise. * * @param duration the milliseconds to query, which may be negative * @return the value of the field, in the units of the field, which may be * negative */ public int getValue(long duration) { return FieldUtils.safeToInt(getValueAsLong(duration)); }
public int getDifference(long minuendInstant, long subtrahendInstant) { return FieldUtils.safeToInt(getDifferenceAsLong(minuendInstant, subtrahendInstant)); }
/** * Multiply two values to return an int throwing an exception if overflow occurs. * * @param val1 the first value * @param val2 the second value * @return the new total * @throws ArithmeticException if the value is too big or too small */ public static int safeMultiplyToInt(long val1, long val2) { long val = FieldUtils.safeMultiply(val1, val2); return FieldUtils.safeToInt(val); }
public long add(long instant, long value) { return add(instant, FieldUtils.safeToInt(value)); }
public long add(long instant, long years) { return add(instant, FieldUtils.safeToInt(years)); }
public int getDifference(long minuendInstant, long subtrahendInstant) { return FieldUtils.safeToInt(FieldUtils.safeSubtract(minuendInstant, subtrahendInstant)); }
public int getDifference(long minuendInstant, long subtrahendInstant) { return FieldUtils.safeToInt(FieldUtils.safeSubtract(minuendInstant, subtrahendInstant)); }
public int getDifference(long minuendInstant, long subtrahendInstant) { return FieldUtils.safeToInt(getDifferenceAsLong(minuendInstant, subtrahendInstant)); }
public long add(long instant, long value) { return add(instant, FieldUtils.safeToInt(value)); }
public long add(long instant, long years) { return add(instant, FieldUtils.safeToInt(years)); }
/** * Converts this duration to a period in seconds assuming that there are the * standard number of milliseconds in a second. * <p> * This method assumes that there are 1000 milliseconds in a second. * All currently supplied chronologies use this definition. * * @return a period representing the number of standard seconds in this period, never null * @throws ArithmeticException if the number of seconds is too large to be represented * @since 1.6 */ public Seconds toStandardSeconds() { long seconds = getStandardSeconds(); return Seconds.seconds(FieldUtils.safeToInt(seconds)); }
/** * Converts this duration to a period in minutes assuming that there are the * standard number of milliseconds in a minute. * <p> * This method assumes that there are 60 seconds in a minute and * 1000 milliseconds in a second. * All currently supplied chronologies use this definition. * * @return a period representing the number of standard minutes in this period, never null * @throws ArithmeticException if the number of minutes is too large to be represented * @since 2.0 */ public Minutes toStandardMinutes() { long minutes = getStandardMinutes(); return Minutes.minutes(FieldUtils.safeToInt(minutes)); }
/** * Converts this duration to a period in hours assuming that there are the * standard number of milliseconds in an hour. * <p> * This method assumes that there are 60 minutes in an hour, * 60 seconds in a minute and 1000 milliseconds in a second. * All currently supplied chronologies use this definition. * * @return a period representing the number of standard hours in this period, never null * @throws ArithmeticException if the number of hours is too large to be represented * @since 2.0 */ public Hours toStandardHours() { long hours = getStandardHours(); return Hours.hours(FieldUtils.safeToInt(hours)); }
/** * Converts this duration to a period in days assuming that there are the * standard number of milliseconds in a day. * <p> * This method assumes that there are 24 hours in a day, * 60 minutes in an hour, 60 seconds in a minute and 1000 milliseconds in * a second. This will be true for most days, however days with Daylight * Savings changes will not have 24 hours, so use this method with care. * * @return a period representing the number of standard days in this period, never null * @throws ArithmeticException if the number of days is too large to be represented * @since 2.0 */ public Days toStandardDays() { long days = getStandardDays(); return Days.days(FieldUtils.safeToInt(days)); }