Re: Unit test patches

From: John Lister <john(dot)lister(at)kickstone(dot)com>
To: Kris Jurka <books(at)ejurka(dot)com>
Cc: John Lister <john(dot)lister-ps(at)kickstone(dot)com>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Unit test patches
Date: 2009-05-06 21:25:29
Message-ID: 4A020049.9050702@kickstone.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Kris Jurka wrote:
>
>
> On Sun, 3 May 2009, John Lister wrote:
>
>> Ok, call it BST then :) I was trying to avoid confusion....
>>
>
> OK, I get the failures if I set my timezone to 'Europe/London', but
> with your patch applied I get the same failure setting my timezone to
> 'US/Pacific'. I haven't looked to see exactly what's going on, but
> your patch isn't completely right. Can you get something to work for
> both of these cases?
>
OK, i've done some more testing and i'd be grateful if anyone can repeat
this or tell me the fundamental flaw in my logic.... I don't think it
has anything to do with the driver and apologies as i realise that this
is more of a straight java question.. I've rebooted between tests after
changing the timezone, etc to see if that had any effect - which it didn't

Windows XP SP3 - JDK 1.6.0.13.

for all of these i do this first:
Time t=new Time(28862000); // this should be 8:01:02 UTC

Now taking the string of t using toString() i get the following (when
dst is not active i've simply shifted the clock forward 6 months)

CET (GMT+1, DST auto-adjust enabled and not active) - 09:01:02
- This is ok...
CEST (GMT +1, DST auto-adjust enabled and active) - 09:01:02
- Actually Correct as the date part is 1/1/1970 which isn't DST
CET (GMT+1, DST auto-adjust disabled) - 09:01:02
- Again this is ok...
(same for other time zones)

Now the odd bit
Europe/London (DST auto-adjust enabled but not active) - 09:01:02 -
This is wrong, it should be equiv to GMT
Europe/London (DST auto-adjust enabled and active) - 09:01:02 -
This is wrong (DST shouldn't matter as the date part is 1/1/1970)
Europe/London (DST auto-adjust disabled) - 08:01:02
- ok and just GMT as we'd expect

Am i going mad - its been a long day or is something wierd going on?

This is what is causing the problem, the driver sets the time using
toString() as above and inserts the wrong time into the db. BTW the
check for DST when reading back the data in the test is superfluous as
the date associated with the time is always 1/1/1970 as i originally
spotted except I incorrectly assumed the current DST was applied which
it shouldn't be...

Thanks

JOHN

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Simon Riggs 2009-05-06 21:59:54 Re: Very strange performance decrease when reusing a PreparedStatement
Previous Message Kris Jurka 2009-05-04 21:49:08 Re: Unit test patches