Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 8FCA165A002 for ; Wed, 19 May 2010 04:28:05 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 54557-02 for ; Wed, 19 May 2010 07:27:54 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail63.csoft.net (mail63.csoft.net [205.205.214.4]) by mail.postgresql.org (Postfix) with ESMTP id 0576A659FF7 for ; Wed, 19 May 2010 04:27:54 -0300 (ADT) Received: from mail63.csoft.net (localhost [127.0.0.1]) by mail63.csoft.net (Postfix) with ESMTP id A5ECC28432; Wed, 19 May 2010 03:27:52 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=csoft.net; h=date:from:to :cc:subject:in-reply-to:message-id:references:mime-version :content-type; s=sel1; bh=bjo9EPy/51QOoPwabNonZxjcWnY=; b=i+yx1O 0vNU7dRRdm+gcs75cB4h0sfCN/Q2Lcnk12EJIniDhgvOfZAeTcEJqcOaTrBbcV0I m6+YmkTd4FXktojyP731TdgSf4CiT2QYowntGMgjyUj0eeoiyOaQAD7tySFJ9tPs vJLrhGGAEGauCdjRkAGdhfOVwSYH2+ZwR6/UU= Received: from leary.csoft.net (leary.csoft.net [205.205.214.5]) by mail63.csoft.net (Postfix) with ESMTP id 30F0E2842A; Wed, 19 May 2010 03:27:52 -0400 (EDT) Received: by leary.csoft.net (Postfix, from userid 1112) id 06EC9A3A8; Wed, 19 May 2010 03:27:51 -0400 (EDT) Date: Wed, 19 May 2010 03:27:51 -0400 (EDT) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: Thomas Kellerer cc: pgsql-jdbc@postgresql.org Subject: Re: JDBC Driver and timezones In-Reply-To: Message-ID: References: <4BF32A15.8010502@opencloud.com> User-Agent: Alpine 2.00 (BSO 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; format=flowed; charset=US-ASCII X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201005/53 X-Sequence-Number: 20537 On Wed, 19 May 2010, Thomas Kellerer wrote: > System.out.println("DST active: " + TimeZone.getDefault().useDaylightTime()); > System.out.println("DST delta: " + TimeZone.getDefault().getDSTSavings()); > > it correctly shows me that the JDK knows that DST is active and that it > should add one hour > (without setting a timezone when starting the JVM) 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. Kris Jurka