Ticket #5134 (closed defect: fixed)

Bug contains 4 commit(s) | SVN Diffs for #5134

 

Opened 3 years ago

Last modified 1 year ago

TimeZone#getOffset returns wrong offset for days in early 20th century or before

Reported by: yoshito_umaoka(at)us.ibm.com Assigned to: yoshito
Priority: minor Milestone: 3.6
Component: unknown Version: 3.4
Keywords: closed Cc:
Load: Xref:
Java Version: other Operating System: win32
Project (C/J): ICU4J Weeks: 0
Review: srl,ram

Description

TimeZone#getOffset returns wrong results for days < 1920. This issue is found for many time zones. For example -


import com.ibm.icu.util.TimeZone;

public class TimeZoneTest {

public static void main(String[] args) {

TimeZone tz = TimeZone.getTimeZone("America/New_York"); java.util.TimeZone jdktz =

java.util.TimeZone.getTimeZone("America/New_York");

long time = -1633284000000L; System.out.println("ICU: " + tz.getOffset(time)); System.out.println("JDK: " + jdktz.getOffset(time));

}

}


ICU: -14400000 JDK: -18000000


OlsonTimeZone implementation load the transition information from the resource, but it does not handle the very first transition data. Thus, offset calculation for a date before the second transition data is broken.

Attachments

Change History

12/31/69 17:25:30 changed by notes

The offset rule for after the first offset transition before the second one was also used for time before the first transition. For this reason, if the first transition is for daylight saving time, time before the first transition was always treated as daylight saving time, which is incorrect.

12/31/69 17:25:31 changed by auditor

  • Sat Apr 8 09:28:17 2006 dougfelt changed notes2: assign: "" to "srl", priority: "" to "medium", target: "UNSCH" to "3.6",
  • Sat Apr 8 09:28:17 2006 dougfelt moved from incoming to others
  • Wed Aug 9 08:37:07 2006 ram changed notes2: assign: "srl" to "yoshito",
  • Sat Aug 12 21:07:33 2006 yoshito changed notes2: review: "" to "srl,ram", weeks: "" to "0.2",
  • Sat Aug 12 21:07:33 2006 yoshito changed notes
  • Tue Aug 22 13:13:10 2006 ram changed notes
  • Tue Aug 22 13:13:10 2006 ram moved from others to fixed
  • Sun Oct 22 07:39:03 2006 grhoten moved from fixed to closed

Add/Change #5134 (TimeZone#getOffset returns wrong offset for days in early 20th century or before)




Anti spam check: