8027848: The ZoneInfoFile doesn't honor future GMT offset changes
authoraefimov
Fri, 15 Nov 2013 15:06:04 +0400
changeset 21842 81911f748777
parent 21838 72472170840d
child 21843 766fef71e8bb
8027848: The ZoneInfoFile doesn't honor future GMT offset changes Reviewed-by: sherman, coffeys
jdk/src/share/classes/sun/util/calendar/ZoneInfoFile.java
--- a/jdk/src/share/classes/sun/util/calendar/ZoneInfoFile.java	Thu Nov 21 11:58:51 2013 -0800
+++ b/jdk/src/share/classes/sun/util/calendar/ZoneInfoFile.java	Fri Nov 15 15:06:04 2013 +0400
@@ -406,6 +406,9 @@
     // LocalDateTime.of(2037, 1, 1, 0, 0, 0).toEpochSecond(ZoneOffset.UTC));
     private static final long LDT2037 = 2114380800L;
 
+    //Current time. Used to determine future GMToffset transitions
+    private static final long CURRT = System.currentTimeMillis()/1000;
+
     /* Get a ZoneInfo instance.
      *
      * @param standardTransitions  the standard transitions, not null
@@ -427,8 +430,10 @@
         boolean willGMTOffsetChange = false;
 
         // rawOffset, pick the last one
-        if (standardTransitions.length > 0)
+        if (standardTransitions.length > 0) {
             rawOffset = standardOffsets[standardOffsets.length - 1] * 1000;
+            willGMTOffsetChange = standardTransitions[standardTransitions.length - 1] > CURRT;
+        }
         else
             rawOffset = standardOffsets[0] * 1000;