VLab Issue #10021 - Add new timezones for Guam and Samoa;
Small reorg of static variable; Remove useless if-block; fixes #10021 Change-Id: I9d3b9f7aea25144f919e93139d1dba1602ea35b2 Former-commit-id: 87e1202202892ed61e3abbce46206c837742dbe5
This commit is contained in:
parent
e629828706
commit
ec32901f77
1 changed files with 20 additions and 10 deletions
|
@ -28,12 +28,15 @@ import java.util.TimeZone;
|
||||||
|
|
||||||
|
|
||||||
public class SHEFTimezone {
|
public class SHEFTimezone {
|
||||||
|
public static final HashMap<String, TimeZone> sysTimeZones = new HashMap<String, TimeZone>();
|
||||||
|
|
||||||
public static final int TZ_NOTFOUND = -9999;
|
public static final int TZ_NOTFOUND = -9999;
|
||||||
|
|
||||||
public static final TimeZone GMT_TIMEZONE = TimeZone
|
public static final TimeZone GMT_TIMEZONE = TimeZone
|
||||||
.getTimeZone(ShefConstants.Z);
|
.getTimeZone(ShefConstants.Z);
|
||||||
|
|
||||||
private static final HashMap<String, TimeZoneEntry> timeZoneMap = new HashMap<String, TimeZoneEntry>();
|
private static final HashMap<String, TimeZoneEntry> timeZoneMap = new HashMap<String, TimeZoneEntry>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
timeZoneMap.put("Z", new TimeZoneEntry("Z", 0, null,
|
timeZoneMap.put("Z", new TimeZoneEntry("Z", 0, null,
|
||||||
"Zulu time, also Greenwich Mean Time (GMT)"));
|
"Zulu time, also Greenwich Mean Time (GMT)"));
|
||||||
|
@ -122,9 +125,25 @@ public class SHEFTimezone {
|
||||||
timeZoneMap.put("J",
|
timeZoneMap.put("J",
|
||||||
new TimeZoneEntry("J", -480, TimeZone.getTimeZone("PRC"),
|
new TimeZoneEntry("J", -480, TimeZone.getTimeZone("PRC"),
|
||||||
"China"));
|
"China"));
|
||||||
|
timeZoneMap.put(
|
||||||
|
"G",
|
||||||
|
new TimeZoneEntry("G", -600, TimeZone
|
||||||
|
.getTimeZone("Pacific/Guam"), "Chamorro local time"));
|
||||||
|
timeZoneMap
|
||||||
|
.put("GS",
|
||||||
|
new TimeZoneEntry("GS", -600, TimeZone
|
||||||
|
.getTimeZone("Pacific/Guam"),
|
||||||
|
"Chamorro standard time"));
|
||||||
|
timeZoneMap.put(
|
||||||
|
"S",
|
||||||
|
new TimeZoneEntry("S", 660, TimeZone
|
||||||
|
.getTimeZone("Pacific/Samoa"), "Samoan local time"));
|
||||||
|
timeZoneMap.put(
|
||||||
|
"SS",
|
||||||
|
new TimeZoneEntry("SS", 660, TimeZone
|
||||||
|
.getTimeZone("Pacific/Samoa"), "Samoan standard time"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final HashMap<String, TimeZone> sysTimeZones = new HashMap<String, TimeZone>();
|
|
||||||
static {
|
static {
|
||||||
// Use this timezone to "clone" the daylight savings time rules.
|
// Use this timezone to "clone" the daylight savings time rules.
|
||||||
for (String key : timeZoneMap.keySet()) {
|
for (String key : timeZoneMap.keySet()) {
|
||||||
|
@ -187,15 +206,6 @@ public class SHEFTimezone {
|
||||||
c.set(Calendar.SECOND, 0);
|
c.set(Calendar.SECOND, 0);
|
||||||
c.set(Calendar.MILLISECOND, 0);
|
c.set(Calendar.MILLISECOND, 0);
|
||||||
|
|
||||||
if(h == 1) {
|
|
||||||
GregorianCalendar g = (GregorianCalendar) c.clone();
|
|
||||||
g.set(Calendar.HOUR_OF_DAY, 0);
|
|
||||||
if(tz.inDaylightTime(g.getTime())) {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
System.out.println(String.format("hour = %2d time = %s", h, sdf.format(c.getTime())));
|
System.out.println(String.format("hour = %2d time = %s", h, sdf.format(c.getTime())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue