Re: PGparam timestamp question - Mailing list pgsql-hackers

From Andrew Chernow
Subject Re: PGparam timestamp question
Date
Msg-id 475D3369.1080403@esilo.com
Whole thread Raw
In response to Re: PGparam timestamp question  (Michael Meskes <meskes@postgresql.org>)
List pgsql-hackers
 >>Or was the code incorrectly used?
Hard for me to say, but I think its about caller context.  The way I am using it 
might be different ... hey the function was static ... copy & paster be warned!

The code appears to be doing the same thing as the backend (with the exclusion 
of backend stuff like HasCTZSet and forced conversions).  I plan to do an 
extensive test sometime today.  So far, I am getting the correct timestamp 
conversions across the board.

Andrew


Michael Meskes wrote:
> On Sun, Dec 09, 2007 at 11:54:25AM -0500, Andrew Chernow wrote:
>> That explains why my libpq code was getting 3AM for "without time zone" 
>> values.  I am using code from src/interfaces/ecpg/pgtypeslib/timestamp.c 
>> timestamp2tm().  That uses localtime() after converting the timestamp to an 
>> epoch value.  I changed this code so that it calls gmtime() for 
>> TIMESTAMPOID and localtime() for TIMESTAMPTZOID.  Now it works perfectly :)
> 
> Does this mean pgtypeslib is buggy? This code has been taken from the
> backend ages ago, so some changes might have occured that I'm not aware
> of. Or was the code incorrectly used?
> 
> Michael


pgsql-hackers by date:

Previous
From: Dave Page
Date:
Subject: Re: Release Note Changes
Next
From: Andrew Dunstan
Date:
Subject: Re: Release Note Changes