public interface TransitionHistory
Keeps all offset transitions and rules of a timezone.
Note: This interface can be considered as stable since version v2.2. Preliminary experimental versions of this interface existed since v1.0 but there was originally not any useable implementation.
Specification: All implementations must be immutable, thread-safe and serializable.
| Modifier and Type | Method and Description |
|---|---|
void |
dump(java.lang.Appendable buffer)
Creates a dump of this history and writes it to the given buffer.
|
ZonalTransition |
getConflictTransition(GregorianDate localDate,
WallTime localTime)
Returns the conflict transition where given local timestamp
falls either in a gap or in an overlap on the local timeline.
|
ZonalOffset |
getInitialOffset()
Return the initial offset no matter if there are any
transitions defined or not.
|
ZonalTransition |
getNextTransition(UnixTime ut)
Queries the next transition after given global timestamp.
|
ZonalTransition |
getStartTransition(UnixTime ut)
Queries the last transition which defines the offset
for given global timestamp.
|
java.util.List<ZonalTransition> |
getStdTransitions()
Return the offset transitions from UNIX epoch [1970-01-01T00:00Z]
until about one year after the current timestamp.
|
java.util.List<ZonalTransition> |
getTransitions(UnixTime startInclusive,
UnixTime endExclusive)
Returns the defined transitions in given POSIX-interval.
|
java.util.List<ZonalOffset> |
getValidOffsets(GregorianDate localDate,
WallTime localTime)
Determines the suitable offsets at given local timestamp..
|
boolean |
isEmpty()
Determines if this history does not have any transitions.
|
ZonalOffset getInitialOffset()
Return the initial offset no matter if there are any transitions defined or not.
If any transition is defined then the initial offset
is identical to the shift getPreviousOffset() of
the first defined transition in history.
ZonalTransition getStartTransition(UnixTime ut)
Queries the last transition which defines the offset for given global timestamp.
ut - unix reference timeZonalTransition or null if given reference time
is before first defined transitionZonalTransition getNextTransition(UnixTime ut)
Queries the next transition after given global timestamp.
ut - unix reference timeZonalTransition or null if given reference time
is after any defined transitionZonalTransition getConflictTransition(GregorianDate localDate, WallTime localTime)
Returns the conflict transition where given local timestamp falls either in a gap or in an overlap on the local timeline.
Note that only the expression localDate.getYear() is used
to determine the daylight saving rules to be applied in calculation.
This is particularly important if there is a wall time of 24:00. Here
only the date before merging to next day matters, not the date of the
whole timestamp.
localDate - local date in timezonelocalTime - local wall time in timezonenullgetValidOffsets(GregorianDate,WallTime)java.util.List<ZonalOffset> getValidOffsets(GregorianDate localDate, WallTime localTime)
Determines the suitable offsets at given local timestamp..
The offset list is empty if the local timestamp falls in a gap on the local timeline. The list has exactly two offsets sorted by size if the local timestamp belongs to two different timepoints on the POSIX timescale due to an overlap. Otherwise the offset list will contain exactly one suitable offset.
Note that only the expression localDate.getYear() is used
to determine the daylight saving rules to be applied in calculation.
This is particularly important if there is a wall time of 24:00. Here
only the date before merging to next day matters, not the date of the
whole timestamp.
localDate - local date in timezonelocalTime - local wall time in timezonegetConflictTransition(GregorianDate,WallTime)java.util.List<ZonalTransition> getStdTransitions()
Return the offset transitions from UNIX epoch [1970-01-01T00:00Z] until about one year after the current timestamp.
Indeed, a potentially bigger interval is obtainable by
getTransitions(UnixTime,UnixTime), but earlier or
later timepoints are usually not reliable. For example the
wide-spread IANA/Olson-repository is only designed for times
since UNIX epoch and offers some selected older data to the
best of our knowledge. Users must be aware that even older
data can be changed as side effect of data corrections. Generally
the timezone concept was invented in 19th century. And future
transitions are even less reliable due to political arbitrariness.
java.util.List<ZonalTransition> getTransitions(UnixTime startInclusive, UnixTime endExclusive)
Returns the defined transitions in given POSIX-interval.
startInclusive - start time on POSIX time scaleendExclusive - end time on POSIX time scalejava.lang.IllegalArgumentException - if start is after endgetStdTransitions()boolean isEmpty()
Determines if this history does not have any transitions.
true if there are no transitions else falsevoid dump(java.lang.Appendable buffer) throws java.io.IOException
Creates a dump of this history and writes it to the given buffer.
buffer - buffer to write the dump tojava.io.IOException - in any case of I/O-errors