8313813: Field sun.util.calendar.CalendarDate#forceStandardTime is never set
Reviewed-by: aturbanov, naoto
This commit is contained in:
parent
5308bbbcf8
commit
373e37bf13
src/java.base/share/classes/sun/util/calendar
@ -165,31 +165,18 @@ public abstract class AbstractCalendar extends CalendarSystem {
|
||||
if (date.isNormalized()) {
|
||||
return ms - date.getZoneOffset();
|
||||
}
|
||||
|
||||
// adjust time zone and daylight saving
|
||||
int[] offsets = new int[2];
|
||||
if (date.isStandardTime()) {
|
||||
// 1) 2:30am during starting-DST transition is
|
||||
// intrepreted as 2:30am ST
|
||||
// 2) 5:00pm during DST is still interpreted as 5:00pm ST
|
||||
// 3) 1:30am during ending-DST transition is interpreted
|
||||
// as 1:30am ST (after transition)
|
||||
if (zi instanceof ZoneInfo) {
|
||||
((ZoneInfo)zi).getOffsetsByStandard(ms, offsets);
|
||||
zoneOffset = offsets[0];
|
||||
} else {
|
||||
zoneOffset = zi.getOffset(ms - zi.getRawOffset());
|
||||
}
|
||||
// 1) 2:30am during starting-DST transition is
|
||||
// interpreted as 3:30am DT
|
||||
// 2) 5:00pm during DST is interpreted as 5:00pm DT
|
||||
// 3) 1:30am during ending-DST transition is interpreted
|
||||
// as 1:30am DT/0:30am ST (before transition)
|
||||
if (zi instanceof ZoneInfo zInfo) {
|
||||
// Offset value adjusts accordingly depending on DST status of date
|
||||
zoneOffset = zInfo.getOffsetsByWall(ms, new int[2]);
|
||||
} else {
|
||||
// 1) 2:30am during starting-DST transition is
|
||||
// intrepreted as 3:30am DT
|
||||
// 2) 5:00pm during DST is intrepreted as 5:00pm DT
|
||||
// 3) 1:30am during ending-DST transition is interpreted
|
||||
// as 1:30am DT/0:30am ST (before transition)
|
||||
if (zi instanceof ZoneInfo) {
|
||||
zoneOffset = ((ZoneInfo)zi).getOffsetsByWall(ms, offsets);
|
||||
} else {
|
||||
zoneOffset = zi.getOffset(ms - zi.getRawOffset());
|
||||
}
|
||||
zoneOffset = zi.getOffset(ms - zi.getRawOffset());
|
||||
}
|
||||
}
|
||||
ms -= zoneOffset;
|
||||
|
@ -26,7 +26,6 @@
|
||||
package sun.util.calendar;
|
||||
|
||||
import java.lang.Cloneable;
|
||||
import java.util.Locale;
|
||||
import java.util.TimeZone;
|
||||
|
||||
/**
|
||||
@ -82,9 +81,6 @@ public abstract class CalendarDate implements Cloneable {
|
||||
private TimeZone zoneinfo;
|
||||
private int zoneOffset;
|
||||
private int daylightSaving;
|
||||
private boolean forceStandardTime;
|
||||
|
||||
private Locale locale;
|
||||
|
||||
protected CalendarDate() {
|
||||
this(TimeZone.getDefault());
|
||||
@ -293,22 +289,10 @@ public abstract class CalendarDate implements Cloneable {
|
||||
return normalized;
|
||||
}
|
||||
|
||||
|
||||
public boolean isStandardTime() {
|
||||
return forceStandardTime;
|
||||
}
|
||||
|
||||
public boolean isDaylightTime() {
|
||||
if (isStandardTime()) {
|
||||
return false;
|
||||
}
|
||||
return daylightSaving != 0;
|
||||
}
|
||||
|
||||
protected void setLocale(Locale loc) {
|
||||
locale = loc;
|
||||
}
|
||||
|
||||
public TimeZone getZone() {
|
||||
return zoneinfo;
|
||||
}
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
package sun.util.calendar;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.TimeZone;
|
||||
|
||||
class ImmutableGregorianDate extends BaseCalendar.Date {
|
||||
@ -146,18 +145,10 @@ class ImmutableGregorianDate extends BaseCalendar.Date {
|
||||
return date.isNormalized();
|
||||
}
|
||||
|
||||
public boolean isStandardTime() {
|
||||
return date.isStandardTime();
|
||||
}
|
||||
|
||||
public boolean isDaylightTime() {
|
||||
return date.isDaylightTime();
|
||||
}
|
||||
|
||||
protected void setLocale(Locale loc) {
|
||||
unsupported();
|
||||
}
|
||||
|
||||
public TimeZone getZone() {
|
||||
return date.getZone();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user