Re: [GENERAL] binary timestamp conversion

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: H Hale <hhale21(at)yahoo(dot)com>, pgsql-interfaces(at)postgresql(dot)org
Subject: Re: [GENERAL] binary timestamp conversion
Date: 2005-10-15 03:09:26
Message-ID: 20051015030926.GA22137@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-interfaces

On Fri, Oct 14, 2005 at 05:04:35PM -0400, Tom Lane wrote:
> H Hale <hhale21(at)yahoo(dot)com> writes:
> > I save 1970-01-01 00:00:00 and read it back expecting
> > the difference between postgres and unix epochs but
> > get different results each time.
>
> > (After conversion to host byte order).
>
> Sounds to me like you're picking up garbage rather than the data you
> should.

Dunno if this is significant, but the garbage appears to be confined
to the lower 32 bits, at least in the three examples given:

test=> select val, to_hex(val) from foo;
val | to_hex
------------------+------------------
-946686612744257 | fffca2fe58bbd7bf
-946684195712577 | fffca2fee8ccd1bf
-946684196834881 | fffca2fee8bbb1bf

> Does your code to fetch the binary value produce correct answers
> on an ordinary int8 column?

Could we see the code? A minimal but complete program that somebody
else could compile and run might be revealing.

--
Michael Fuhr

In response to

Browse pgsql-interfaces by date

  From Date Subject
Next Message Kelly Burkhart 2005-10-19 19:03:06 pl/pythonu - return values
Previous Message Tom Lane 2005-10-14 21:04:35 Re: [GENERAL] binary timestamp conversion