-
Bug
-
Resolution: Fixed
-
P3
-
1.4.0, 5.0u6
-
b76
-
x86
-
windows_2000, windows_xp
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2134959 | 5.0u8 | Yuka Kamiya | P4 | Resolved | Fixed | b01 |
Hardware: Pentium IV
OS: Windows XP Professional SP2
Java version: java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)
Problem: TimeZone.getDefault() returns two different timezones for Windows GMT-12 regarding to the 'Automatically adjust clock for daylight saving changes' is checked and not. When the daylight saving adjustment checkbox is off, java correctly recogizes GMT-12 as "GMT-12:00". But when it's checked on, Pacific/Majuro is returned, whose timezone is GMT+12.
Test case: A simple program is provided to re-produce the problem. It can be re-produced always.
//////////////////////////////////////////////////////////////
// TestTimeZone.java - BEGIN //
//////////////////////////////////////////////////////////////
import java.util.*;
public class TestTimeZone
{
public static void main(String[] args)
{
System.out.println("timezone is " + TimeZone.getDefault());
System.out.println("time is " + new Date());
}
}
//////////////////////////////////////////////////////////////
// TestTimeZone.java - END //
//////////////////////////////////////////////////////////////
Steps to re-produce:
1. Compile the above program.
2. Select Windows XP timezone as (GMT+10:00) Canberra, Melbourne, Sydney.
3. Un-check the 'Automatically adjust clock for daylight saving changes' checkbox.
4. Change the timezone to (GMT-12:00) International Dateline West.
5. Run the test program. It should give you a similar output like below. It's correct.
=========== step 5 output begin ===============
timezone is sun.util.calendar.ZoneInfo[id="GMT-12:00",offset=-43200000,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
time is Sun Feb 26 18:39:02 GMT-12:00 2006
=========== step 5 output end ==================
6. Select Windows XP timezone again as (GMT+10:00) Canberra, Melbourne, Sydney.
7. Check on the 'Automatically adjust clock for daylight saving changes'.
8. Change the timezone to (GMT-12:00) International Dateline West.
9. Run the test program again. It'll give you a similar output like below. It's incorrect.
=========== step 9 output begin ===============
timezone is sun.util.calendar.ZoneInfo[id="Pacific/Majuro",offset=43200000,dstSavings=0,useDaylight=false,transitions=4,lastRule=null]
time is Mon Feb 27 18:37:53 MHT 2006
=========== step 9 output end ==================
Notice that, Pacific/Majuro is a timezone of GMT+12. So the application gets 24-hours time difference as the DST is on and not for GMT-12 on Windows.
OS: Windows XP Professional SP2
Java version: java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)
Problem: TimeZone.getDefault() returns two different timezones for Windows GMT-12 regarding to the 'Automatically adjust clock for daylight saving changes' is checked and not. When the daylight saving adjustment checkbox is off, java correctly recogizes GMT-12 as "GMT-12:00". But when it's checked on, Pacific/Majuro is returned, whose timezone is GMT+12.
Test case: A simple program is provided to re-produce the problem. It can be re-produced always.
//////////////////////////////////////////////////////////////
// TestTimeZone.java - BEGIN //
//////////////////////////////////////////////////////////////
import java.util.*;
public class TestTimeZone
{
public static void main(String[] args)
{
System.out.println("timezone is " + TimeZone.getDefault());
System.out.println("time is " + new Date());
}
}
//////////////////////////////////////////////////////////////
// TestTimeZone.java - END //
//////////////////////////////////////////////////////////////
Steps to re-produce:
1. Compile the above program.
2. Select Windows XP timezone as (GMT+10:00) Canberra, Melbourne, Sydney.
3. Un-check the 'Automatically adjust clock for daylight saving changes' checkbox.
4. Change the timezone to (GMT-12:00) International Dateline West.
5. Run the test program. It should give you a similar output like below. It's correct.
=========== step 5 output begin ===============
timezone is sun.util.calendar.ZoneInfo[id="GMT-12:00",offset=-43200000,dstSavings=0,useDaylight=false,transitions=0,lastRule=null]
time is Sun Feb 26 18:39:02 GMT-12:00 2006
=========== step 5 output end ==================
6. Select Windows XP timezone again as (GMT+10:00) Canberra, Melbourne, Sydney.
7. Check on the 'Automatically adjust clock for daylight saving changes'.
8. Change the timezone to (GMT-12:00) International Dateline West.
9. Run the test program again. It'll give you a similar output like below. It's incorrect.
=========== step 9 output begin ===============
timezone is sun.util.calendar.ZoneInfo[id="Pacific/Majuro",offset=43200000,dstSavings=0,useDaylight=false,transitions=4,lastRule=null]
time is Mon Feb 27 18:37:53 MHT 2006
=========== step 9 output end ==================
Notice that, Pacific/Majuro is a timezone of GMT+12. So the application gets 24-hours time difference as the DST is on and not for GMT-12 on Windows.
- backported by
-
JDK-2134959 TimeZone.getDefault() returns different timezones for Windows GMT-12 when DST is checked and not.
- Resolved
- duplicates
-
JDK-4813722 (tz) Windows XP GMT-12 time zone should be supported
- Closed
- relates to
-
JDK-4252829 Win32: platform-to-java timezone mapping has errors; mapping tables are obsolete
- Resolved
-
JDK-6362432 (tz) TimeZone.getDefault() returns incorrect timezone.
- Closed