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

JDK 1.1.1 TimeZone implementation issues

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 1.1.1
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • CPU:
      generic
    • OS:
      solaris_2.5.1

      Description

      SUMMARY:
        JDK 1.1.1 built in TimeZone GMT has daylight savings.

        GMT does not have daylight savings. GMT is simply GMT. if the implementors of the
        TimeZone class were looking to provide a UK simplified TimeZone (using the SimpleTimeZone
        implementation), then they should have used a better name than GMT.

        GB-Eire according to the rules in the Solaris zoneinfo file (/usr/share/lib/zoneinfo/europe)
        is far from being a simply change between GMT (the time we use during the winter, ie October
        to March), and BST, British Summer Time (the UK name for the summer period when we put the
        clocks forward 1hr). GB-Eire addresses the various different change over weekends that
        different acts of parliament have produced. The TimeZone GMT is somewhat simplified to:

          Last Sunday in March 2am
          4th Sunday in October at 2 am

        which according to the latest 2.5.1 zoneinfo file is pretty close to the rules for how
        we now switch (before 1996 it was a little more complicated).

        surely the solution here is to make the TimeZone GMT truly GMT, ie no daylight savings,
        and create a new TimeZone SimpleGBEire, which has the simplified rules:

          Last Sunday in March 2am
          Last Sunday in October at 2 am


      REPRODUCE:

      To reproduce the problem compile the following with the JDK 1.1.1

      javac TZTest.java
      java TZTest

      He is the output from the program:

      sfitch@kuta >java TZTest
      Now: 864379752515
      Date.toString(): Fri May 23 10:29:12 GMT+01:00 1997

      System Default TimeZone: GMT
      DateFormat Default TimeZone: GMT

      Timezone Date avail in use
      ----------------------------------------------------------------------
      Default 23/05/97 10:29 BST true true
      System Default 23/05/97 10:29 BST true true
      GMT 23/05/97 10:29 BST true true

      CODE:

      import java.util.*;
      import java.text.*;

      public class TZTest {

          public static void main(String args[]) {
              TimeZone tz;

              tz = TimeZone.getDefault();
              Date d = new Date();
              DateFormat df = new SimpleDateFormat("dd/MM/yy HH:mm z");

              System.out.println("Now: " + d.getTime());
              System.out.println("Date.toString(): " + d.toString());
              System.out.println("");

              System.out.println("System Default TimeZone: " + tz.getID());
              System.out.println("DateFormat Default TimeZone: " +
                                                      df.getTimeZone().getID());
              System.out.println("");

              System.out.println("Timezone\t\tDate\t\t\tavail\tin use");
              System.out.println("-----------------------------------------------------------------
      -----");

              System.out.println("Default\t\t\t" + df.format(d) + "\t" +
                              df.getTimeZone().useDaylightTime() + "\t" +
                              df.getTimeZone().inDaylightTime(d));

              df.setTimeZone(tz);
              System.out.println("System Default\t\t" + df.format(d) + "\t" +
                                      tz.useDaylightTime() + "\t" +
                                      tz.inDaylightTime(d));

              tz = TimeZone.getTimeZone("GMT");
              df.setTimeZone(tz);
              System.out.println("GMT\t\t\t" + df.format(d) + "\t" +
                                      tz.useDaylightTime() + "\t" +
                                      tz.inDaylightTime(d));
          }
      }


        Attachments

          Issue Links

            Activity

              People

              Assignee:
              ssenthilsunw Shanmugam Senthil (Inactive)
              Reporter:
              duke J. Duke (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: