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.
| Modifier and Type | Method and Description |
|---|---|
double |
getLength()
Defines the typical length of this time unit in seconds without
taking into account anomalies like timezone effects or leap seconds.
|
default boolean |
isCalendrical()
Queries if this time unit is calendrical respective is at least
as long as a calendar day.
|
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.
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().
true if at least as long as a day else falseCopyright © 2014–2017. All rights reserved.