From: John Lister <john.lister-ps@kickstone.com>
To: pgsql-jdbc@postgresql.org
Subject: getTiIme/Timestamp with TimeZone inconsistency
Date: Sat, 02 May 2009 14:23:43 +0100
Message-ID: <49FC495F.1020302@kickstone.com> (raw)
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-jdbc@postgresql.org
Cc: john.lister-ps@kickstone.com
Subject: Re: getTiIme/Timestamp with TimeZone inconsistency
In-Reply-To: <49FC495F.1020302@kickstone.com>
References: <49FC495F.1020302@kickstone.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox