Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 19B39133740B for ; Thu, 2 Dec 2010 03:12:27 -0400 (AST) 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 08123-05 for ; Thu, 2 Dec 2010 07:12:19 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from progressive.micfo.com (progressive.micfo.com [174.34.188.2]) by mail.postgresql.org (Postfix) with ESMTP id 51AE71335B36 for ; Thu, 2 Dec 2010 03:12:19 -0400 (AST) Received: from 87-204-194-135.dg-net.pl ([87.204.194.135]:55002 helo=radek.localnet) by progressive.micfo.com with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1PO1n2-0002Kw-Oy; Wed, 01 Dec 2010 23:33:08 -0600 From: =?utf-8?q?Rados=C5=82aw_Smogura?= To: Oliver Jowett Subject: Re: Storing timestamps in text format Date: Thu, 2 Dec 2010 06:33:08 +0100 User-Agent: KMail/1.13.5 (Linux/2.6.34-gentoo-r12; KDE/4.4.5; x86_64; ; ) Cc: pgsql-jdbc@postgresql.org References: <4CF6D96F.2060500@opencloud.com> In-Reply-To: <4CF6D96F.2060500@opencloud.com> MIME-Version: 1.0 Content-Type: Text/Plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <201012020633.08702.rsmogura@softperience.eu> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - progressive.micfo.com X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - softperience.eu X-Source: X-Source-Args: X-Source-Dir: X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201012/21 X-Sequence-Number: 21259 Oliver Jowett Thursday 02 December 2010 00:25:35 > Rados=C5=82aw Smogura wrote: > > Hi, > >=20 > > I perform following test: > > 1. Open connection (GMT+1) > > 2. Change timezone (GMT+3) > > 3. Write created timestamp. > > 4. Change timezone to different connection open and write (GMT+4) > > 5. Read timezone > >=20 > > During this I saw driver sends timestamp encoded with initial (in my ca= se > > +1), form connection open, time zone. It's because > > TimestampUtils.toString(Calendar, Timestamp) uses defaultCal. Should it > > use Calendar.getInstance() or new GregorianCalendar? > >=20 > > public synchronized String toString(Calendar cal, Timestamp x) { > > =20 > > if (cal =3D=3D null) > > =20 > > cal =3D defaultCal; // =3D Calendar.getInstance() // new > >=20 > > GregorianCalendar() >=20 > There seems to be some confusion about what the bug you are reporting > actually is. >=20 > Is the bug that if you change the JVM's default timezone halfway through > a run, the change is not reflected in the driver? (i.e. defaultCal is > initialized once only). Or is it something else? Yes, problem is when I change default timezone during run. > I vaguely remember that when writing this code, getting the default > calendar was quite expensive.. > Oliver Creating Gregorian Calendar, without fields set in constructir is realy=20 expensive. To address this we can use {TimeZone, Local} -> GregCal thread=20 local map, or this what I thinking about is to create new=20 GC(0,0,0).setTime(....); =2D-=20 =2D--------- Rados=C5=82aw Smogura http://www.softperience.eu