pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Oliver Jowett <oliver@opencloud.com>
To: Mikko Tiihonen <mikko.tiihonen@iki.fi>
Cc: pgsql-jdbc <pgsql-jdbc@postgresql.org>
Subject: Re: Make time/timestamp tests fair for binary transfers
Date: Tue, 24 Jul 2007 10:30:35 +1200
Message-ID: <46A52C0B.7070608@opencloud.com> (raw)
In-Reply-To: <1185213747.1632.116.camel@dual.local>
References: <1185213747.1632.116.camel@dual.local>

Mikko Tiihonen wrote:

> The patch also alters what kind of java.sql.Time values are returned.
> Before the patch the millisecond value of a ResultSet.getTime could be
> between -24h<x<24h. The patch changes the returned value to be always
> between 0h<=x<24h. If someone thinks this change is not acceptable I'll
> go back and revert it re-fix the test cases to match.

I'm not sure if this is right. In theory Time values are meant to have a 
day/month/year of Jan 1 1970. Time (via Date) uses the local timezone to 
compute the day/month/year. But to represent all time values in all 
local timezones that means you need negative millisecond values (to 
handle timezones ahead of UTC). For example, Jan 1 1970 02:00 +1200 is 
actually Dec 31 1969 14:00 UTC, which is a negative milliseconds value.

There's an additional complication that if you're dealing with time 
values in different timezones, it'd imply that 2am +1200 is identical to 
2pm UTC, which is not entirely true.. they're on different days. 
Currently they'd return Time values that are exactly one day apart, with 
this change they'd return identical Time values.

As usual, the javadoc is fairly hopeless at telling you how Time is 
actually supposed to behave!

(I wonder what java.sql.Time.valueOf() returns in timezones ahead of 
UTC? Might be worth testing..)

-O



view thread (5+ messages)  latest in thread

Message-ID: <46A52C0B.7070608@opencloud.com>
Permalink:  ../46A52C0B.7070608@opencloud.com/
Also on:    postgresql.org/message-id/46A52C0B.7070608@opencloud.com

 · 

reply

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: oliver@opencloud.com, mikko.tiihonen@iki.fi
  Subject: Re: Make time/timestamp tests fair for binary transfers
  In-Reply-To: <46A52C0B.7070608@opencloud.com>
  References: <1185213747.1632.116.camel@dual.local> <46A52C0B.7070608@opencloud.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