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

(cal) Not consistent behaviour on Gregorian Calendar with dayligth saving

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 5.0
    • core-libs

      FULL PRODUCT VERSION :
      java version "1.5.0_02"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_02-b09)
      Java HotSpot(TM) Client VM (build 1.5.0_02-b09, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Windows 2000

      A DESCRIPTION OF THE PROBLEM :
      When the date for dayligth saving is reached the GregorianCalendar has no consistant behaviour and return different values if a set has been done or not .

      It seems ( but may be i'm wrong) that the policy for going from
      the internal field to the timemillisecond and for going from the timemillisecond to the internal field are not the same and don't considere the dayligth saving in the same way .



      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      On a timezone Europe/Dublin (GMT+00:00) Dublin, Edinburgh, London, Lisbon
      Rettrieve a calendar
      set the time UTC 1130630400000L(Sun Oct 30 02:00:00 CEST 2005)
           
           long ts = 1130630400000L;
           c.setTimeInMillis(ts);

      set the number of minutes to 0 ( which should not change anything because it
      was previously at the same value )
         
          c.set(Calendar.MINUTE, 0);

      retrieve the UTC time from the calendar

           long tst = c.getTimeInMillis();

      The both timestamps are not the same.
         

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      the both timestamps should be the same.


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      Calendar c = Calendar.getInstance(TimeZone.getTimeZone("Europe/Dublin"));
       long ts = 1130630400000L;
      c.setTimeInMillis(ts);
      c.set(Calendar.MINUTE, 0);
      long tst = c.getTimeInMillis();
      if(tst!=ts){
         System.err.println("Error");
      }
      ---------- END SOURCE ----------
      ###@###.### 2005-04-26 09:52:28 GMT

            okutsu Masayoshi Okutsu
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: