Interface ChronoUnit

All Known Subinterfaces:
IsoDateUnit, IsoTimeUnit, IsoUnit
All Known Implementing Classes:
BadiCalendar.Unit, BasicUnit, CalendarUnit, ChineseCalendar.Unit, ClockUnit, CopticCalendar.Unit, EthiopianCalendar.Unit, EthiopianTime.Unit, FrenchRepublicanCalendar.Unit, HebrewCalendar.Unit, HebrewTime.Unit, HijriCalendar.Unit, IndianCalendar.Unit, JapaneseCalendar.Unit, JulianCalendar.Unit, KoreanCalendar.Unit, PersianCalendar.Unit, SI, VietnameseCalendar.Unit, Weekcycle

public interface ChronoUnit

External time units which are not registered on any chronology (time axis) can implement this interface in order to support standard calculations in time spans and symbol formatting.

Naming convention: Time units have Java-names in plural form.

Note: All implementations must be immutable.

Author:
Meno Hochschild
  • Method Summary

    Modifier and Type
    Method
    Description
    double
    Defines the typical length of this time unit in seconds without taking into account anomalies like timezone effects or leap seconds.
    default boolean
    Queries if this time unit is calendrical respective is at least as long as a calendar day.
  • Method Details

    • getLength

      double getLength()

      Defines the typical length of this time unit in seconds without taking into account anomalies like timezone effects or leap seconds.

      Important note: This method can only yield an estimated value and is not intended to assist in calculations of durations, but only in sorting of units.

      Returns:
      estimated decimal value in seconds
    • isCalendrical

      default boolean isCalendrical()

      Queries if this time unit is calendrical respective is at least as long as a calendar day.

      Implementation note: The method must be consistent with the typical length of the unit. The expression Double.compare(unit.getLength(), 86400.0) >= 0 is equivalent to unit.isCalendrical().

      Returns:
      true if at least as long as a day else false