Hi, Here is a simple test: public final class Test { public static void main(String[] args) { System.out.println(new Date(5).getTimezoneOffset()); } } On gcj on my system, this returns -300. On the JDK, it returns 300. Attached is a simple patch which shoudl correct the problem.
Created attachment 8077 [details] correctly negate getTimezoneOffset
Colin, is this one the cause of the setTimeStamp/getTimeStamp mismatch with postgre jdbc? I have a testcase for that one in case it's of any use...
Yeah, I'm almost positive it's the cause. At least I narrowed down this behavior difference in JDK versus gcj, but it's possible there's another bug in there. Is the test suite patch for mauve? I think they'd be interested in that.
I've put a test case for this in mauve: gnu/testlet/java/util/Date/getTimezoneOffset.java This test case also exposes some problems with libgcj's underlying TimeZone data. This patch looks correct, though. I'm going to check it in.
Turns out its already fixed in GNU Classpath. Re-syncing with their version.
Subject: Bug 19649 CVSROOT: /cvs/gcc Module name: gcc Changes by: bryce@gcc.gnu.org 2005-01-29 00:43:51 Modified files: libjava : ChangeLog libjava/java/util: Date.java Log message: 2004-01-28 Jeroen Frijters <jeroen@frijters.net> PR libgcj/19649 * java/util/Date.java (Date(int,int,int), Date(int,int,int,int,int)): Delegate to other constructor. (Date(int,int,int,int,int,int)): Fixed to handle out-of-range arguments. (getTimezoneOffset): Inverted sign. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/ChangeLog.diff?cvsroot=gcc&r1=1.3296&r2=1.3297 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libjava/java/util/Date.java.diff?cvsroot=gcc&r1=1.14&r2=1.15
Fixed