<i18n dev> Open Jdk Timezone bug?

Andrew John Hughes gnu_andrew at member.fsf.org
Wed Dec 2 12:09:38 PST 2009


2009/12/2 Bill Tims (RSI) <btims at rsitex.com>:
> Andrew/Masayoshi
>
>   After some research it appears that we have the openjdk-6-jre-lib package, version b11, installed and it is current according to Ubuntu.

Ok, newer versions will also include the IcedTea version in java -version,

$ /home/andrew/build/icedtea6/bin/java -version
java version "1.6.0_0"
OpenJDK Runtime Environment (IcedTea6 1.7pre-r1b34da20e2d1) (build 1.6.0_0-b17)
OpenJDK 64-Bit Server VM (build 16.0-b10, mixed mode)

but I think those that use OpenJDK6 b11 are too old to do so.

> The latest openjdk-6-jre has the same version number. Masayoshi indicates in an earlier email that the current version is 6u17.

The latest is b17, the number Masayoshi quotes sounds like a version
of the proprietary JDK6 (as you are using on Windows, 6u7 in that
case) rather than an OpenJDK6 version.
It would be nice if such responses were posted to the public list...

>
> When I run the app I wrote (I've added a dump of the version info from system properties) that displays the offset for America/Chicago for 1900 I get:
> version=1.6.0_0
> vendor=Sun Microsystems Inc.
> java.vm.specification.version=1.0
> java.vm.specification.vendor=Sun Microsystems Inc.
> java.vm.version=1.6.0_0-b11
> java.vm.vendor=Sun Microsystems Inc.
> timezone.id=America/Chicago
> date=Mon Jan 01 00:00:00 CDT 1900
> 1900/0:-18000000
> 1900/1:-18000000
> 1900/2:-18000000
> 1900/3:-18000000
> 1900/4:-18000000
> 1900/5:-18000000
> 1900/6:-18000000
> 1900/7:-18000000
> 1900/8:-18000000
> 1900/9:-18000000
> 1900/10:-21600000
> 1900/11:-21600000
>
> The display is year/month#:offset.
> The same program running under the Sun jdk on windows gives me:
> version=1.6.0_07
> vendor=Sun Microsystems Inc.
> java.vm.specification.version=1.0
> java.vm.specification.vendor=Sun Microsystems Inc.
> java.vm.version=10.0-b23
> java.vm.vendor=Sun Microsystems Inc.
> timezone.id=America/Chicago
> date=Mon Jan 01 00:00:00 CST 1900
> 1900/0:-21600000
> 1900/1:-21600000
> 1900/2:-21600000
> 1900/3:-21600000
> 1900/4:-21600000
> 1900/5:-21600000
> 1900/6:-21600000
> 1900/7:-21600000
> 1900/8:-21600000
> 1900/9:-21600000
> 1900/10:-21600000
> 1900/11:-21600000
>

Do you have a simple test case (probably creating a Date object and
printing it would be enough)?
If you want to know what timezone data is actually being used, you can
run something like strace -o out -f java TestApp and the resulting
file, out, will show the C calls being made to open the timezone data
files.
My guess is that the Ubuntu version uses /usr/share/javazi rather than
the OpenJDK timezone data (which, for OpenJDK6, is very outdated -
fixing that is on my TODO list).
This is due to the patch icedtea-use-system-tzdata.patch in IcedTea
which contains:

+  SystemProperty* sp = Arguments::system_properties();
+  // Use the system zoneinfo files, if present
+  Arguments::PropertyList_add (&sp,
+                               new
SystemProperty("user.zoneinfo.dir", "/usr/share/javazi",true));
+

A newer version was submitted upstream but has not yet been approved:

http://mail.openjdk.java.net/pipermail/i18n-dev/2009-August/000136.html

(it's debatable whether such a fix is needed over just a simple symlink).

> Bill
>
> Bill Tims
> Renaissance Systems, Inc.
> 5426 Guadalupe, Suite 100
> Austin, TX  78751
> 512-275-0344
>
>
> -----Original Message-----
> From: gnu.andrew.rocks at gmail.com [mailto:gnu.andrew.rocks at gmail.com] On Behalf Of Andrew John Hughes
> Sent: Wednesday, December 02, 2009 8:54 AM
> To: Masayoshi Okutsu
> Cc: Bill Tims (RSI); i18n-dev at openjdk.java.net
> Subject: Re: <i18n dev> Open Jdk Timezone bug?
>
> 2009/12/1 Masayoshi Okutsu <Masayoshi.Okutsu at sun.com>:
>> What is the time zone ID you are using?
>>
>> Thanks,
>> Masayoshi
>>
>> On 12/1/2009 1:55 AM, Bill Tims (RSI) wrote:
>>>
>>> From what I can find, this appears to be the right place to post
>>> this, if I'm wrong I would appreciate a pointer to the proper location.
>>>  The database our app has to talk to has January 1,1900 12:00:00 am
>>> date in it.  When I load the value into a open jdk date object (using
>>> Ubuntu/JBoss 4.2.3 GA-jdk6) I get December 31, 1899 23:00:00.  When I
>>> do the same thing on my dev box (Win XP/Sun jre 1.6.0_07) I get
>>> January 1, 1900 12:00:00 am.  I wrote a test program that prints out
>>> the Timezone info for 1898-1902 and it appears that the open jdk has
>>> a daylight savings time starting on Jan 1, 1900 through Oct 1, 1900
>>> and the sun version doesn't.  According to Wikipedia, Daylight
>>> savings wasn't suggested until 1907.
>>>  I can't find anything on the web that suggests where the timezone
>>> info is kept or how complicated it will be to rebuild whatever jar
>>> file is required. Can someone point me to the proper source file and
>>> suggest how involved building the fix will be?
>>>  Thanks
>>>    Bill
>>>  !
>>>
>>> Bill Tims
>>>
>>> Renaissance Systems, Inc.
>>>
>>>
>>>
>>
>
> You don't give any details of the OpenJDK version - what does 'java -version' give on your Ubuntu box?
> If this is the system OpenJDK build, then it's an IcedTea build and thus includes a patch to use the system timezone data which is likely to be more up-to-date than that bundled with Sun's JDK.
> --
> Andrew :-)
>
> Free Java Software Engineer
> Red Hat, Inc. (http://www.redhat.com)
>
> Support Free Java!
> Contribute to GNU Classpath and the OpenJDK http://www.gnu.org/software/classpath
> http://openjdk.java.net
>
> PGP Key: 94EFD9D8 (http://subkeys.pgp.net)
> Fingerprint: F8EF F1EA 401E 2E60 15FA  7927 142C 2591 94EF D9D8
>



-- 
Andrew :-)

Free Java Software Engineer
Red Hat, Inc. (http://www.redhat.com)

Support Free Java!
Contribute to GNU Classpath and the OpenJDK
http://www.gnu.org/software/classpath
http://openjdk.java.net

PGP Key: 94EFD9D8 (http://subkeys.pgp.net)
Fingerprint: F8EF F1EA 401E 2E60 15FA  7927 142C 2591 94EF D9D8


More information about the i18n-dev mailing list