提交 871f00cb 编写于 作者: O okutsu

7021989: Missing observesDaylightTime override in ZoneInfo

Reviewed-by: peytoia
上级 57215b34
......@@ -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.
*/
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册