Index: jdbcResultSet.java =================================================================== RCS file: /cvsroot/hsqldb/hsqldb-dev/src/org/hsqldb/jdbc/jdbcResultSet.java,v retrieving revision 1.6 diff -u -r1.6 jdbcResultSet.java --- jdbcResultSet.java 13 May 2004 13:32:32 -0000 1.6 +++ jdbcResultSet.java 28 Apr 2005 16:03:52 -0000 @@ -4373,6 +4373,23 @@ return getTime(findColumn(columnName), cal); } + // Adjusts an "erroneous date" as retrieved from HSQL which represents the + // result of reading a date formatted for user supplied timezone by + // actually using the JVM default timezone (occurs in Column.convertObject) + // AMB 07/04/05 + // NB this method will behave incorrectly for a few hours around daylight + // changeover points since the TimeZone offset is being calculated from + // an erroneous date. This will be hard to solve without correcting + // HSQL date infrastructure. Need to get hold of the date before + // Column sees it. + private void adjustToTimeZone(java.util.Date toadjust, Calendar target) { + if (toadjust != null) { + long adjusttime = toadjust.getTime(); + int targetoffset = target.getTimeZone().getOffset(adjusttime); + int defaultoffset = TimeZone.getDefault().getOffset(adjusttime); + toadjust.setTime(toadjust.getTime() + defaultoffset - targetoffset); + } + } /** * * Retrieves the value of the designated column in the current row @@ -4397,7 +4414,9 @@ */ public java.sql.Timestamp getTimestamp(int columnIndex, Calendar cal) throws SQLException { - return getTimestamp(columnIndex); + java.sql.Timestamp togo = getTimestamp(columnIndex); + adjustToTimeZone(togo, cal); + return togo; } /**