Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 3FD23635C33 for ; Thu, 27 May 2010 16:29:30 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 08768-06-3 for ; Thu, 27 May 2010 19:29:22 +0000 (UTC) Received: from news.hub.org (news.hub.org [200.46.204.72]) by mail.postgresql.org (Postfix) with ESMTP id AAA4F634970 for ; Thu, 27 May 2010 16:29:13 -0300 (ADT) Received: from news.hub.org (news.hub.org [200.46.204.72]) by news.hub.org (8.14.3/8.14.3) with ESMTP id o4RJSlKa031458 for ; Thu, 27 May 2010 16:29:10 -0300 (ADT) (envelope-from news@news.hub.org) Received: (from news@localhost) by news.hub.org (8.14.3/8.14.3/Submit) id o4JFXZrm090572 for pgsql-jdbc@postgresql.org; Wed, 19 May 2010 12:33:35 -0300 (ADT) (envelope-from news) From: Lew X-Newsgroups: pgsql.interfaces.jdbc,comp.lang.java.programmer Subject: Re: JDBC Driver and timezones Date: Wed, 19 May 2010 11:33:30 -0400 Organization: albasani.net Lines: 34 Message-ID: References: <58BC6ABC13304B81B573AD7AFC0F3763@squarepi.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@albasani.net X-User-ID: rWkaSzbvsb9HOeGdDTQXq3XefK4Ycx+mTzJ4qwKiqSs= In-Reply-To: <58BC6ABC13304B81B573AD7AFC0F3763@squarepi.com> Cancel-Lock: sha1:DcZez31P8unU8RlAeMUNz7s4d2Q= User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.9) Gecko/20100423 Thunderbird/3.0.4 X-NNTP-Posting-Host: vIne7hx8mTkalYTGgoWlDfIiKNPyIfYDAS9j4TnMfhA= To: pgsql-jdbc@postgresql.org X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.79 tagged_above=-10 required=5 tests=BAYES_50=0.8, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201005/81 X-Sequence-Number: 20565 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