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

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.

Activity

Show:
TracBot
June 30, 2018, 11:33 PM
Trac Comment by notes—1970-01-01T01:25:30.000Z

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.

TracBot
June 30, 2018, 11:33 PM
Trac Comment by auditor—1970-01-01T01:25:31.000Z
  • 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

Fixed

Assignee

Yoshito Umaoka

Reporter

TracBot

Components

Labels

None

Reviewer

None

Priority

minor

Time Needed

None

Fix versions