Skip site navigation (1) Skip section navigation (2)

Re: Storing timestamps in text format

From: Oliver Jowett <oliver(at)opencloud(dot)com>
To: Radosław Smogura <rsmogura(at)softperience(dot)eu>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Storing timestamps in text format
Date: 2010-12-01 23:25:35
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc
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..


In response to


pgsql-jdbc by date

Next:From: LewDate: 2010-12-01 23:43:21
Subject: Re: [HACKERS] Improved JDBC driver part 2
Previous:From: Dave CramerDate: 2010-12-01 21:36:18
Subject: Re: Storing timestamps in text format

Privacy Policy | About PostgreSQL
Copyright © 1996-2018 The PostgreSQL Global Development Group