Re: Unit test patches - Mailing list pgsql-jdbc

From John Lister
Subject Re: Unit test patches
Date
Msg-id 4A020049.9050702@kickstone.com
Whole thread Raw
In response to Re: Unit test patches  (Kris Jurka <books@ejurka.com>)
Responses Re: Unit test patches  (Kris Jurka <books@ejurka.com>)
List 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


pgsql-jdbc by date:

Previous
From: John Lister
Date:
Subject: Re: Unit test patches
Next
From: Kris Jurka
Date:
Subject: Re: Unit test patches