-
Bug
-
Resolution: Not an Issue
-
P3
-
None
-
1.4.0
-
sparc
-
solaris_8
Name: nt126004 Date: 05/17/2002
FULL PRODUCT VERSION :
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 :
SunOS cwit115 5.8 Generic_108528-07 sun4u sparc
SUNW,Ultra-5_10
A DESCRIPTION OF THE PROBLEM :
The getDSTSavings() method of SimpleTimeZone should give
the daylight savings offset for the timezone. With JDK 1.4
this value always seems to return 0 (with 'always' = the
10 or so timezones which use daylight savings time that I
tried :-)
Even if useDaylightTime() = true, getDSTSavings still
returns 0.
REGRESSION. Last worked in version 1.3.1
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
1. Run the code included with JDK 1.4
2. Run the code included with JDK 1.3.1
3. Compare output (in particular last line in the set)
EXPECTED VERSUS ACTUAL BEHAVIOR :
Results with JDK 1.3.1
offset from GMT = 0
ID = Europe/London
tz uses dst = true
DST offset = 1
**********************************
offset from GMT = -5
ID = America/New_York
tz uses dst = true
DST offset = 1
Note DST offset = 1hr in both cases
With JDK 1.4 the results are
offset from GMT = 0
ID = Europe/London
tz uses dst = true
DST offset = 0
**********************************
offset from GMT = -5
ID = America/New_York
tz uses dst = true
DST offset = 0
Note in this case DST offset = 0
ERROR MESSAGES/STACK TRACES THAT OCCUR :
No error message
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
import java.util.*;
public class TimeZoneTest
{
public static void main(String [] args_)
{
TimeZone tz = TimeZone.getTimeZone("Europe/London");
SimpleTimeZone stz = new SimpleTimeZone( tz.getRawOffset(), tz.getID() );
int offset = stz.getDSTSavings();
int convert = 1000 * 60 * 60;
System.out.println("offset from GMT = "+(tz.getRawOffset()/convert));
System.out.println("ID = "+tz.getID());
System.out.println("tz uses dst = "+tz.useDaylightTime());
System.out.println("DST offset = "+(offset/convert));
System.out.println("**********************************");
tz = TimeZone.getTimeZone("America/New_York");
stz = new SimpleTimeZone( tz.getRawOffset(), tz.getID() );
offset = stz.getDSTSavings();
System.out.println("offset from GMT = "+(tz.getRawOffset()/convert));
System.out.println("ID = "+tz.getID());
System.out.println("tz uses dst = "+tz.useDaylightTime());
System.out.println("DST offset = "+(offset/convert));
}
}
---------- END SOURCE ----------
Release Regression From : 1.3.1
The above release value was the last known release where this
bug was known to work. Since then there has been a regression.
(Review ID: 146683)
======================================================================
- relates to
-
JDK-4300378 API: SimpleTimeZone: getDSTSavings() is returning improper value.
-
- Closed
-