-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
1.4.0
-
x86
-
linux
Name: jl125535 Date: 01/15/2003
FULL PRODUCT VERSION :
java version "1.3.0_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0_04)
Java HotSpot(TM) Client VM (build 1.3.0_04, mixed mode)
and
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.0-b92)
Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)
FULL OPERATING SYSTEM VERSION :
> rpm --query glibc
glibc-2.2.2-60
> uname -a
Linux vwm-cds 2.4.18-64GB-SMP #2 SMP Sun Mar 10 13:04:13 CET
2002 i686 unknown
SuSE Linux 7.2 (i386)
VERSION = 7.2
A DESCRIPTION OF THE PROBLEM :
For certain time zones the JDK 1.4 gives different values
for the local time than the operating system, but JDK 1.3
gives the same result. The basic problem seems that the JDK
1.4 does not always has the correct values for the daylight
switch.
This misbehavior happens only for certain time zone, e.g.
for America/Mexico_City. S. below the steps to reproduce
that also show my local results.
BTW: JDK 1.4 is fine with America/Monterrey, which is
unknown to JDK 1.3, ...
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. compile the code TestDate.java (s. below) with JDK 1.3
2. Adjust the script testDate.sh (s. below) to use the
proper JDKs.
3. Run the script testDate.sh (s. below)
4. Analyze the output.
EXPECTED VERSUS ACTUAL BEHAVIOR :
The result from running the script testDate.sh is:
Calling date from this machine gives:
Wed Aug 7 06:08:18 CDT 2002
Calling date -u from this machine gives:
Wed Aug 7 11:08:18 UTC 2002
Result running TestDate with JDK:
java version "1.3.0_04"
Java(TM) 2 Runtime Environment, Standard Edition (build
1.3.0_04)
Java HotSpot(TM) Client VM (build 1.3.0_04, mixed mode)
America/Mexico_City (The default time zone on this machine.)
Current date: Wed Aug 07 06:08:18 GMT-05:00 2002
INFO:
java.util.SimpleTimeZone[id=America/Mexico_City,offset=-21600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=3,startDay=1,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]
America/Mexico_City
Current date: Wed Aug 07 06:08:18 GMT-05:00 2002
INFO:
java.util.SimpleTimeZone[id=America/Mexico_City,offset=-21600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=3,startDay=1,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]
GMT
Current date: Wed Aug 07 11:08:18 GMT 2002
INFO:
java.util.SimpleTimeZone[id=GMT,offset=0,dstSavings=3600000,useDaylight=false,startYear=0,startMode=0,startMonth=0,startDay=0,startDayOfWeek=0,startTime=0,startTimeMode=0,endMode=0,endMonth=0,endDay=0,endDayOfWeek=0,endTime=0,endTimeMode=0]
Europe/Moscow
Current date: Wed Aug 07 15:08:18 MSD 2002
INFO:
java.util.SimpleTimeZone[id=Europe/Moscow,offset=10800000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=10800000,endTimeMode=0]
Result running TestDate with JDK:
java version "1.4.0"
Java(TM) 2 Runtime Environment, Standard Edition (build
1.4.0-b92)
Java HotSpot(TM) Client VM (build 1.4.0-b92, mixed mode)
America/Mexico_City (The default time zone on this machine.)
Current date: Wed Aug 07 05:08:19 CST 2002
INFO:
sun.util.calendar.ZoneInfo[id="America/Mexico_City",offset=-21600000,dstSavings=0,useDaylight=false,transitions=28,lastRule=null]
America/Mexico_City
Current date: Wed Aug 07 05:08:19 CST 2002
INFO:
sun.util.calendar.ZoneInfo[id="America/Mexico_City",offset=-21600000,dstSavings=0,useDaylight=false,transitions=28,lastRule=null]
America/Monterrey
Current date: Wed Aug 07 06:08:19 CDT 2002
INFO:
sun.util.calendar.ZoneInfo[id="America/Monterrey",offset=-21600000,dstSavings=3600000,useDaylight=true,transitions=88,lastRule=java.util.SimpleTimeZone[id=America/Monterrey,offset=-21600000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=3,startMonth=4,startDay=1,startDayOfWeek=1,startTime=7200000,startTimeMode=0,endMode=2,endMonth=8,endDay=-1,endDayOfWeek=1,endTime=7200000,endTimeMode=0]]
Europe/Moscow
Current date: Wed Aug 07 15:08:19 MSD 2002
INFO:
sun.util.calendar.ZoneInfo[id="Europe/Moscow",offset=10800000,dstSavings=3600000,useDaylight=true,transitions=130,lastRule=java.util.SimpleTimeZone[id=Europe/Moscow,offset=10800000,dstSavings=3600000,useDaylight=true,startYear=0,startMode=2,startMonth=2,startDay=-1,startDayOfWeek=1,startTime=7200000,startTimeMode=1,endMode=2,endMonth=9,endDay=-1,endDayOfWeek=1,endTime=7200000,endTimeMode=1]]
ERROR MESSAGES/STACK TRACES THAT OCCUR :
- None -
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
/*
* TestDate.java
*
* Created on 5. August 2002, 16:22
*/
import java.util.Date;
import java.util.TimeZone;
import java.util.SimpleTimeZone;
import java.util.Arrays;
import java.util.Calendar;
import java.util.GregorianCalendar;
/**
*
* @author jens
*/
public class TestDate {
/** Creates a new instance of TestDate */
public TestDate() {
}
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
TimeZone tz;
//default
tz = TimeZone.getDefault();
System.out.println(tz.getID() + " (The default time zone on this
machine.)");
System.out.println("Current date: " + new Date());
System.out.println("INFO: " + tz);
System.out.println();
//Mexico City
TimeZone.setDefault(TimeZone.getTimeZone("America/Mexico_City"));
tz = TimeZone.getDefault();
System.out.println(tz.getID());
System.out.println("Current date: " + new Date());
System.out.println("INFO: " + tz);
System.out.println();
//Monterrey
TimeZone.setDefault(TimeZone.getTimeZone("America/Monterrey"));
tz = TimeZone.getDefault();
System.out.println(tz.getID());
System.out.println("Current date: " + new Date());
System.out.println("INFO: " + tz);
System.out.println();
//Moscow
TimeZone.setDefault(TimeZone.getTimeZone("Europe/Moscow"));
tz = TimeZone.getDefault();
System.out.println(tz.getID());
System.out.println("Current date: " + new Date());
System.out.println("INFO: " + tz);
System.out.println();
}
}
#####################################################################
#! /bin/sh
echo Calling date from this machine gives:
date
echo Calling date -u from this machine gives:
date -u
# Using JDK 1.3
echo Result running TestDate with JDK:
java -version
java TestDate
# Using JDK 1.4
echo Result running TestDate with JDK:
../j2sdk1.4.0/bin/java -version
../j2sdk1.4.0/bin/java TestDate
---------- END SOURCE ----------
CUSTOMER WORKAROUND :
set and define the time zone explicitly in your program.
(Review ID: 160471)
======================================================================
- duplicates
-
JDK-4630401 RFE: new time zone data support (tzdata2002b)
- Resolved
- relates to
-
JDK-4663362 RFE: new time zone data tzdata2002c support
- Resolved
-
JDK-4763566 RFE: new time zone data tzdata2002d support
- Resolved