7021989: Missing observesDaylightTime override in ZoneInfo
Reviewed-by: peytoia
This commit is contained in:
parent
7e8c6fd47b
commit
84e687333e
@ -266,7 +266,7 @@ public class ZoneInfo extends TimeZone {
|
||||
int index = getTransitionIndex(date, type);
|
||||
|
||||
// prior to the transition table, returns the raw offset.
|
||||
// should support LMT.
|
||||
// FIXME: should support LMT.
|
||||
if (index < 0) {
|
||||
int offset = getLastRawOffset();
|
||||
if (offsets != null) {
|
||||
@ -452,6 +452,36 @@ public class ZoneInfo extends TimeZone {
|
||||
return (simpleTimeZoneParams != null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean observesDaylightTime() {
|
||||
if (simpleTimeZoneParams != null) {
|
||||
return true;
|
||||
}
|
||||
if (transitions == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Look up the transition table to see if it's in DST right
|
||||
// now or if there's any standard-to-daylight transition at
|
||||
// any future.
|
||||
long utc = System.currentTimeMillis() - rawOffsetDiff;
|
||||
int index = getTransitionIndex(utc, UTC_TIME);
|
||||
|
||||
// before transitions in the transition table
|
||||
if (index < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// the time is in the table range.
|
||||
for (int i = index; i < transitions.length; i++) {
|
||||
if ((transitions[i] & DST_MASK) != 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// No further DST is observed.
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Queries if the specified date is in Daylight Saving Time.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user