getTiIme/Timestamp with TimeZone inconsistency

Поиск
Список
Период
Сортировка
Искать
От
John Lister
Тема
getTiIme/Timestamp with TimeZone inconsistency
Дата
в 10:23:54
Msg-id
49FC495F.1020302@kickstone.com
Список
Дерево обсуждения
getTiIme/Timestamp with TimeZone inconsistency John Lister <john.lister-ps@kickstone.com>
Re: getTiIme/Timestamp with TimeZone inconsistency Oliver Jowett <oliver@opencloud.com>
Re: getTiIme/Timestamp with TimeZone inconsistency John Lister <john.lister-ps@kickstone.com>
Re: getTiIme/Timestamp with TimeZone inconsistency Oliver Jowett <oliver@opencloud.com>
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

В списке pgsql-jdbc по дате отправления
От: Adam B
Дата:
От: Oliver Jowett
Дата:
FAQ