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(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)
Deprecated.
Use the equivalent
findNextTransition(UnixTime) in version v4.18 or later |
ZonalTransition |
getStartTransition(UnixTime ut)
Queries the last transition which defines the offset
for given global timestamp.
|
List<ZonalTransition> |
getStdTransitions()
Return the offset transitions from UNIX epoch [1970-01-01T00:00Z]
until about one year after the current timestamp.
|
List<ZonalTransition> |
getTransitions(UnixTime startInclusive,
UnixTime endExclusive)
Returns the defined transitions in given POSIX-interval.
|
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 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 timezonenullTransitionHistory.getValidOffsets(GregorianDate,WallTime)@Deprecated ZonalTransition getNextTransition(UnixTime ut)
findNextTransition(UnixTime) in version v4.18 or laterQueries the next transition after given global timestamp.
ut - unix reference timeZonalTransition or null if given reference time
is after any defined transitionList<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 timezoneTransitionHistory.getConflictTransition(GregorianDate,WallTime)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
TransitionHistory.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.
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 scaleIllegalArgumentException - if start is after endTransitionHistory.getStdTransitions()boolean isEmpty()
Determines if this history does not have any transitions.
true if there are no transitions else falsevoid dump(Appendable buffer) throws IOException
Creates a dump of this history and writes it to the given buffer.
buffer - buffer to write the dump toIOException - in any case of I/O-errorsCopyright © 2014–2018. All rights reserved.