|
From: Markus S. <mar...@gm...> - 2006-06-07 23:04:05
|
Thanks, Eric. What I found out is quite simple: - .Net uses proleptic time. As they write [1], "Time values are measured in 100-nanosecond units called ticks, and a particular date is the number of ticks since 12:00 midnight, January 1, 0001 A.D. (C.E.) in the GregorianCalendar calendar." and it looks like they mean Gregorian for all dates past and future. - By default, an ICU Calendar is a GregorianCalendar with a change date of October 15, 1582, that is, it's a Julian calendar before that. [2] - There are 2 more days in the ICU (Julian/Gregorian) calendar between 0001 and 1582 than in a purely (proleptic) Gregorian one: ICU has to skip 10 days 1582-Oct-5..14 (inclusive) but add 12 leap days for the non-multiple-of-400 centuries in between. - ICU's Universal Time Scale is supposed to match .Net's System.DateTime. [3] It's off by 2 days. As a fix, I think EpochOffsets.java needs to be modified by replacing Calendar cal = Calendar.getInstance(utc, Locale.ENGLISH); with // use a proleptic Gregorian calendar for 0001AD and later by setting // the Gregorian change date before 0001AD // with a value that is safely before that date by any measure, i.e., // more than 719164 days before 1970 long before0001AD = -750000 * 86400 * 1000; Calendar cal = new GregorianCalendar(utc, Locale.ENGLISH).setGregorianChange(new Date(before0001AD)); >From the looks of it, once this code is fixed, the trio of tools in com.ibm.icu.dev.tool.timescale needs to be re-run, and the results placed into the library source code, and we should be fine. Right? markus [1] .Net System.DateTime documentation: http://msdn2.microsoft.com/en-us/library/03ybds8y.aspx [2] ICU4J GregorianCalendar API ref: http://icu.sourceforge.net/apiref/icu4j/com/ibm/icu/util/GregorianCalendar.html [3] http://icu.sourceforge.net/userguide/universalTimeScale.html On 6/6/06, Eric Mader <em...@ic...> wrote: > The values in utmscale.c were generated using the following tool: > package com.ibm.icu.dev.tool.timescale; > public class EpochOffsets -- Opinions expressed here may not reflect my company's positions unless otherwise noted. |