final class UTCDateTimeZone extends DateTimeZone
This exists instead of using FixedDateTimeZone to avoid deadlocks. https://github.com/JodaOrg/joda-time/issues/171
DateTimeZone.LazyInit
Modifier and Type | Field and Description |
---|---|
(package private) static DateTimeZone |
INSTANCE |
private static long |
serialVersionUID |
UTC
Constructor and Description |
---|
UTCDateTimeZone() |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj)
Compare this datetime zone with another.
|
java.lang.String |
getNameKey(long instant)
Returns a non-localized name that is unique to this time zone.
|
int |
getOffset(long instant)
Gets the millisecond offset to add to UTC to get local time.
|
int |
getOffsetFromLocal(long instantLocal)
Gets the millisecond offset to subtract from local time to get UTC time.
|
int |
getStandardOffset(long instant)
Gets the standard millisecond offset to add to UTC to get local time,
when standard time is in effect.
|
int |
hashCode()
Gets a hash code compatable with equals.
|
boolean |
isFixed()
Returns true if this time zone has no transitions.
|
long |
nextTransition(long instant)
Advances the given instant to where the time zone offset or name changes.
|
long |
previousTransition(long instant)
Retreats the given instant to where the time zone offset or name changes.
|
java.util.TimeZone |
toTimeZone()
Get the datetime zone as a
TimeZone . |
adjustOffset, convertLocalToUTC, convertLocalToUTC, convertUTCToLocal, forID, forOffsetHours, forOffsetHoursMinutes, forOffsetMillis, forTimeZone, getAvailableIDs, getDefault, getID, getMillisKeepLocal, getName, getName, getNameProvider, getOffset, getProvider, getShortName, getShortName, isLocalDateTimeGap, isStandardOffset, setDefault, setNameProvider, setProvider, toString, writeReplace
static final DateTimeZone INSTANCE
private static final long serialVersionUID
public java.lang.String getNameKey(long instant)
DateTimeZone
getNameKey
in class DateTimeZone
instant
- milliseconds from 1970-01-01T00:00:00Z to get the name forpublic int getOffset(long instant)
DateTimeZone
getOffset
in class DateTimeZone
instant
- milliseconds from 1970-01-01T00:00:00Z to get the offset forpublic int getStandardOffset(long instant)
DateTimeZone
getStandardOffset
in class DateTimeZone
instant
- milliseconds from 1970-01-01T00:00:00Z to get the offset forpublic int getOffsetFromLocal(long instantLocal)
DateTimeZone
millisLocal == millisUTC + getOffset(millisUTC) millisUTC == millisLocal - getOffsetFromLocal(millisLocal)NOTE: After calculating millisLocal, some error may be introduced. At offset transitions (due to DST or other historical changes), ranges of local times may map to different UTC times.
For overlaps (where the local time is ambiguous), this method returns the offset applicable before the gap. The effect of this is that any instant calculated using the offset from an overlap will be in "summer" time.
For gaps, this method returns the offset applicable before the gap, ie "winter" offset. However, the effect of this is that any instant calculated using the offset from a gap will be after the gap, in "summer" time.
For example, consider a zone with a gap from 01:00 to 01:59:
Input: 00:00 (before gap) Output: Offset applicable before gap DateTime: 00:00
Input: 00:30 (before gap) Output: Offset applicable before gap DateTime: 00:30
Input: 01:00 (in gap) Output: Offset applicable before gap DateTime: 02:00
Input: 01:30 (in gap) Output: Offset applicable before gap DateTime: 02:30
Input: 02:00 (after gap) Output: Offset applicable after gap DateTime: 02:00
Input: 02:30 (after gap) Output: Offset applicable after gap DateTime: 02:30
NOTE: Prior to v2.0, the DST overlap behaviour was not defined and varied by hemisphere. Prior to v1.5, the DST gap behaviour was also not defined. In v2.4, the documentation was clarified again.
getOffsetFromLocal
in class DateTimeZone
instantLocal
- the millisecond instant, relative to this time zone, to get the offset forpublic boolean isFixed()
DateTimeZone
isFixed
in class DateTimeZone
public long nextTransition(long instant)
DateTimeZone
nextTransition
in class DateTimeZone
instant
- milliseconds from 1970-01-01T00:00:00Zpublic long previousTransition(long instant)
DateTimeZone
previousTransition
in class DateTimeZone
instant
- milliseconds from 1970-01-01T00:00:00Zpublic java.util.TimeZone toTimeZone()
DateTimeZone
TimeZone
.toTimeZone
in class DateTimeZone
public boolean equals(java.lang.Object obj)
DateTimeZone
equals
in class DateTimeZone
obj
- the object to compare withpublic int hashCode()
DateTimeZone
hashCode
in class DateTimeZone