Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id CF76D63223A for ; Sat, 2 May 2009 10:23:53 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 70330-01 for ; Sat, 2 May 2009 10:23:51 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mk-filter-1-a-1.mail.uk.tiscali.com (mk-filter-1-a-1.mail.uk.tiscali.com [212.74.100.52]) by mail.postgresql.org (Postfix) with ESMTP id 4700662E522 for ; Sat, 2 May 2009 10:23:51 -0300 (ADT) X-Trace: 192355429/mk-filter-1.mail.uk.tiscali.com/B2C/$b2c-THROTTLED-DYNAMIC/b2c-CUSTOMER-DYNAMIC-IP/62.64.158.120/None/john.lister-ps@kickstone.com X-SBRS: None X-RemoteIP: 62.64.158.120 X-IP-MAIL-FROM: john.lister-ps@kickstone.com X-SMTP-AUTH: X-MUA: Thunderbird 2.0.0.21 (Windows/20090302) X-IP-BHB: Once X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ArsCAJbm+0k+QJ54/2dsb2JhbAAIzUuDfQU X-IronPort-AV: E=Sophos;i="4.40,283,1238972400"; d="scan'208";a="192355429" Received: from 62-64-158-120.dynamic.dial.as9105.com (HELO [192.168.6.11]) ([62.64.158.120]) by smtp.tiscali.co.uk with ESMTP; 02 May 2009 14:23:48 +0100 Message-ID: <49FC495F.1020302@kickstone.com> Date: Sat, 02 May 2009 14:23:43 +0100 From: John Lister User-Agent: Thunderbird 2.0.0.21 (Windows/20090302) MIME-Version: 1.0 To: pgsql-jdbc@postgresql.org Subject: getTiIme/Timestamp with TimeZone inconsistency Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200905/9 X-Sequence-Number: 19559 Looking at getTime and getTimestamp in TimestampUtils as used by the getTime(int, Calendar) and getTimestamp(int, Calendar) functions in AbstractJDBC2ResultSet there seems to be an inconsistency: The API docs for these state "This method uses the given calendar to construct an appropriate millisecond value for the time if the underlying database does not store timezone information. " and in TimestampUtils .getTimestamp if the server returns a timezone, it is used instead of the supplied calendar. However in TimestampUtils.getTime, this is initially done, but then reversed further down and the supplied timezone is used as follows: if (ts.hasDate) { // Rotate it into the requested timezone before we zero out the date ..... cal.setTime(new Date(useCal.getTime().getTime())); useCal = cal; } is there a reason for this as it seems inconsistent with getTimestamp and the api docs? Removing this makes the unit test TimezoneTest.testTime more consistent (the first group of tests all return the same value - instead of the last one being negative) I ask as i'm playing with the adding binary wire transfer and Mikko Tiihonen original patch omitted time/dates as he reported they failed the unit tests. Thanks