Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6471224

(tz) The Daylight Savings for EST timezone is incorrect.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 1.4.2
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:

      Description

      FULL PRODUCT VERSION :
      java version "1.4.2_12"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_12-b03)
      Java HotSpot(TM) Client VM (build 1.4.2_12-b03, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      The DST offset for the EST timezone is incorrect in 1.4.2_12. The offset is correct in previous releases, tested on 1.4.2_11, 1.4.2_06, 1.4.2_04.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Steps to reproduce are simple: Get the DST for EST Timezone on 1.4.2_12 and 1.4.2_11. Observe the differences.

      Or run the attached app on 1.4.2_12 and then run it on 1.4.2_11.


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -

      Timezone offset between America/New_York and EST timezone is 0 sec or 0 min
      Timezone America/New_York offset is -18,000,000 with DST offset 3,600,000
      Timezone EST offset is -18,000,000 with DST offset 3,600,000


      Timezone offset between America/Chicago and EST timezone is 3,600 sec or 60 min
      Timezone America/Chicago offset is -21,600,000 with DST offset 3,600,000
      Timezone EST offset is -18,000,000 with DST offset 3,600,000


      Timezone offset between America/Denver and EST timezone is 7,200 sec or 120 min
      Timezone America/Denver offset is -25,200,000 with DST offset 3,600,000
      Timezone EST offset is -18,000,000 with DST offset 3,600,000


      Timezone offset between America/Los_Angeles and EST timezone is 10,800 sec or 180 min
      Timezone America/Los_Angeles offset is -28,800,000 with DST offset 3,600,000
      Timezone EST offset is -18,000,000 with DST offset 3,600,000


      Timezone offset between Europe/London and EST timezone is -18,000 sec or -300 min
      Timezone Europe/London offset is 0 with DST offset 3,600,000
      Timezone EST offset is -18,000,000 with DST offset 3,600,000


      Timezone offset between Europe/Berlin and EST timezone is -21,600 sec or -360 min
      Timezone Europe/Berlin offset is 3,600,000 with DST offset 3,600,000
      Timezone EST offset is -18,000,000 with DST offset 3,600,000


      Timezone offset between Europe/Athens and EST timezone is -25,200 sec or -420 min
      Timezone Europe/Athens offset is 7,200,000 with DST offset 3,600,000
      Timezone EST offset is -18,000,000 with DST offset 3,600,000



      ACTUAL -

      Timezone offset between America/New_York and EST timezone is -3,600 sec or -60 min
      Timezone America/New_York offset is -18,000,000 with DST offset 3,600,000
      Timezone EST offset is -18,000,000 with DST offset 0


      Timezone offset between America/Chicago and EST timezone is 0 sec or 0 min
      Timezone America/Chicago offset is -21,600,000 with DST offset 3,600,000
      Timezone EST offset is -18,000,000 with DST offset 0


      Timezone offset between America/Denver and EST timezone is 3,600 sec or 60 min
      Timezone America/Denver offset is -25,200,000 with DST offset 3,600,000
      Timezone EST offset is -18,000,000 with DST offset 0


      Timezone offset between America/Los_Angeles and EST timezone is 7,200 sec or 120 min
      Timezone America/Los_Angeles offset is -28,800,000 with DST offset 3,600,000
      Timezone EST offset is -18,000,000 with DST offset 0


      Timezone offset between Europe/London and EST timezone is -21,600 sec or -360 min
      Timezone Europe/London offset is 0 with DST offset 3,600,000
      Timezone EST offset is -18,000,000 with DST offset 0


      Timezone offset between Europe/Berlin and EST timezone is -25,200 sec or -420 min
      Timezone Europe/Berlin offset is 3,600,000 with DST offset 3,600,000
      Timezone EST offset is -18,000,000 with DST offset 0


      Timezone offset between Europe/Athens and EST timezone is -28,800 sec or -480 min
      Timezone Europe/Athens offset is 7,200,000 with DST offset 3,600,000
      Timezone EST offset is -18,000,000 with DST offset 0




      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package test;

      import java.text.MessageFormat;
      import java.util.Calendar;
      import java.util.TimeZone;


      /**
       * Test case for DST in timezone. The followin test case shows differences between JDK 1.4.2_11 and
       * JDK 1.4.2_12
       */
      public class TestTimezone {

      private static Integer _int(int x) {
      return new Integer(x);
      }

      public static void test(String tz1, String tz2) {

      int utc1 = Calendar.getInstance(TimeZone.getTimeZone(tz1)).get(Calendar.ZONE_OFFSET);
      int utc2 = Calendar.getInstance(TimeZone.getTimeZone(tz2)).get(Calendar.ZONE_OFFSET);

      int utc1d = Calendar.getInstance(TimeZone.getTimeZone(tz1)).get(Calendar.DST_OFFSET);
      int utc2d = Calendar.getInstance(TimeZone.getTimeZone(tz2)).get(Calendar.DST_OFFSET);

      int result = (utc2 + utc2d) - (utc1 + utc1d);

      System.out.println("");

      System.out.println(MessageFormat.format(
      "Timezone offset between {0} and {1} timezone is {2} sec or {3} min",
      new Object[]{ tz1, tz2, _int(result /1000), _int(result/60000) }));

      System.out.println(MessageFormat.format(
      "Timezone {0} offset is {1} with DST offset {2}",
      new Object[] { tz1, _int(utc1), _int(utc1d) }));

      System.out.println(MessageFormat.format(
      "Timezone {0} offset is {1} with DST offset {2}",
      new Object[]{ tz2, _int(utc2), _int(utc2d) }));

      System.out.println("");

      }

      public static void main(String[] args) {
      // America
      test("America/New_York", "EST");
      test("America/Chicago", "EST");
      test("America/Denver", "EST");
      test("America/Los_Angeles", "EST");

      // Europe
      test("Europe/London", "EST");
      test("Europe/Berlin", "EST");
      test("Europe/Athens", "EST");

      }

      }

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Do not EST timezone it is buggy.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              ndcosta Nelson Dcosta (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: