From: Oliver Jowett <oliver@opencloud.com>
To: Radosław Smogura <rsmogura@softperience.eu>
Cc: pgsql-jdbc@postgresql.org
Subject: Re: Storing timestamps in text format
Date: Thu, 02 Dec 2010 12:25:35 +1300
Message-ID: <4CF6D96F.2060500@opencloud.com> (raw)
In-Reply-To: <fc18163a29b69fecf56d6fd2dfdceccd@smogura-softworks.eu>
References: <fc18163a29b69fecf56d6fd2dfdceccd@smogura-softworks.eu>
Radosław Smogura wrote:
> Hi,
>
> 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
>
> During this I saw driver sends timestamp encoded with initial (in my case
> +1), form connection open, time zone. It's because
> TimestampUtils.toString(Calendar, Timestamp) uses defaultCal. Should it use
> Calendar.getInstance() or new GregorianCalendar?
>
> public synchronized String toString(Calendar cal, Timestamp x) {
> if (cal == null)
> cal = defaultCal; // = Calendar.getInstance() // new
> GregorianCalendar()
There seems to be some confusion about what the bug you are reporting
actually is.
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?
I vaguely remember that when writing this code, getting the default
calendar was quite expensive..
Oliver
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, rsmogura@softperience.eu
Subject: Re: Storing timestamps in text format
In-Reply-To: <4CF6D96F.2060500@opencloud.com>
References: <fc18163a29b69fecf56d6fd2dfdceccd@smogura-softworks.eu> <4CF6D96F.2060500@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