pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Lew <noone@lewscanon.com>
To: pgsql-jdbc@postgresql.org
Subject: Re: JDBC Driver and timezones
Date: Wed, 19 May 2010 11:33:30 -0400
Message-ID: <ht10cb$vb2$1@news.albasani.net> (raw)
In-Reply-To: <58BC6ABC13304B81B573AD7AFC0F3763@squarepi.com>
References: <58BC6ABC13304B81B573AD7AFC0F3763@squarepi.com>

Kris Jurka
>> I think the problem is that the Java specification for java.sql.Time
>> requires that the date portion be filled in with 1970-01-01. So when
>> trying to determine the zone shift to apply when printing it out, it is
>> checking with that date instead of today's date as you are expecting.
>>
>> When reading a timetz value in, we don't need to determine what the zone
>> shift is, it's explicit, so in this case we shift by the explicit DST
>> amount. When printing it back out, the original zone offset has been
>> discarded and we shift by the non-DST amount because the date 1970-01-01
>> doesn't use DST. I think we'd like to be able to override the
>> getTimezoneOffset value for the Time object, but there's no easy way to
>> do that without creating our own PgTime object.

On 05/19/2010 06:43 AM, John Lister wrote:
> Hi, I spotted an issue regarding Daylight savings and timezones a while
> ago that affected UK times so it may be possible that it does the same
> in German ones. From memory - essentially the driver uses the epoch date
> to work out DST which unfortunately coincides with a year (1970) when
> the UK temporarily changed its DST rules.

This issue came up in pgsql.interfaces.jdbc and it seemed worth bringing into 
the wider Java world since it's not Postgres-specific.  The problem is that 
java.sql.Time values are date-agnostic so might not reflect the intended DST 
offset when referencing times relevant to "now".

This might be worth a bug report, or perhaps the problem is intractable and 
requires the explicit workaround that the database folks find they must use. 
Perhaps the new date/time libraries will address this somehow.

Opinions or assessments?

-- 
Lew



view thread (13+ messages)

Message-ID: <ht10cb$vb2$1@news.albasani.net>
Permalink:  ../ht10cb$vb2$1@news.albasani.net/
Also on:    postgresql.org/message-id/ht10cb$vb2$1@news.albasani.net

 · 

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: noone@lewscanon.com
  Subject: Re: JDBC Driver and timezones
  In-Reply-To: <ht10cb$vb2$1@news.albasani.net>
  References: <58BC6ABC13304B81B573AD7AFC0F3763@squarepi.com> <ht10cb$vb2$1@news.albasani.net>

* 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