United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-7070044 : (tz) "1927-12-31 23:54:08 000" the moment of date that jumps 352 seconds

Details
Type:
Bug
Submit Date:
2011-07-23
Status:
Closed
Updated Date:
2012-03-20
Project Name:
JDK
Resolved Date:
2011-09-01
Component:
core-libs
OS:
windows_xp
Sub-Component:
java.util:i18n
CPU:
x86
Priority:
P4
Resolution:
Not an Issue
Affected Versions:
6u26
Fixed Versions:

Related Reports

Sub Tasks

Description
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

                                    

Comments
EVALUATION

Assuming the time zone is Asia/Shanghai, Local Mean Time was used until 1928-01-01. The following is the time zone data from the Olson tzdata.

Zone	Asia/Shanghai	8:05:52	-	LMT	1928
			8:00	Shang	C%sT	1949
			8:00	PRC	C%sT

Therefore, the transition is correct.
                                     
2011-09-01
EVALUATION

What's the time zone of the platform on which the program was executed?
                                     
2011-08-01



Hardware and Software, Engineered to Work Together