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

(tz) "1927-12-31 23:54:08 000" the moment of date that jumps 352 seconds

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 6u26
    • core-libs

      FULL PRODUCT VERSION :
      lastest JDK/JRE for win32

      ADDITIONAL OS VERSION INFORMATION :
      windows xp professional x86-32 with all lastest patches

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      nothing

      A DESCRIPTION OF THE PROBLEM :
      When crossing the date "1927-12-31 23:54:07 999" to "1927-12-31 23:54:08 000", in that very milliseconds, the timemillis collected from all date-related classes( e.g. SimpleDateFormat , Calendar, GregorianCalendar) jumps with an added value 352000 suddently.

      REGRESSION. Last worked in version 6u26

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      the bug can be reproduced by calculating the time difference between the date "1927-12-31 23:54:07 999" and the "1927-12-31 23:54:08 000";

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      the correct difference should be 1 millisecond.
      ACTUAL -
      352000 milliseconds.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.text.SimpleDateFormat;
      import java.util.Date;

      public class Test{

      static public SimpleDateFormat date_format=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss SSS");
      static public void printDate(String date_str){
      try {
      long tm= date_format.parse(date_str).getTime();
      System.out.println(date_str+" => "+tm+" => "+date_format.format(new Date(tm)));
      }catch(Exception e){
      e.printStackTrace();
      }
      }
      static public void printDate(long tm){
      try {
      String date_str=date_format.format(new Date(tm));
      System.out.println(tm+" => "+date_str+" => "+date_format.parse(date_str).getTime());
      }catch(Exception e){
      e.printStackTrace();
      }
      }
          public static void main(String[] args) {
      String date_strs[] ={
      "1927-12-31 23:54:07 999",//ONE millisecond before the bug date
      "1927-12-31 23:54:08 000", //The BUG Date
      "1927-12-31 23:54:08 001",//ONE millisecond after the bug date
      };
      for(String ds:date_strs){
      printDate(ds);
      }
      long timemillises[]={
      -1325491904001L,
      -1325491904000L,//get the same date with -1325491552000L below.
      -1325491903999L,
      -1325491903998L,
      -1325491903997L,
      -1325491903996L,

      -1325491552000L,
      -1325491551999L,
      -1325491551998L,
      -1325491551997L,
      -1325491551996L

      };
      for(long tm:timemillises){
      printDate(tm);
      }

          }
      }

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

      CUSTOMER SUBMITTED WORKAROUND :
      i dont know yet

      SUPPORT :
      YES

            okutsu Masayoshi Okutsu
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: