Re: Binary Format of Timestamp - Mailing list pgsql-novice

From Tom Lane
Subject Re: Binary Format of Timestamp
Date
Msg-id 11303.1119939257@sss.pgh.pa.us
Whole thread Raw
In response to Binary Format of Timestamp  (Joe Joe <fondwey@yahoo.com>)
List pgsql-novice
Joe Joe <fondwey@yahoo.com> writes:
> I expect the timestamp format to be a float8 type
> containing the seconds elapsed sind the 1.1.2000. This
> should roughly be something around 172668107, give and
> take a few timezone adjustments. What i get back from
> PQgetvalue is the following array of bytes:

> 0: 0x00
> 1: 0x00
> 2: 0x9d
> 3: 0x0a
> 4: 0x6d
> 5: 0x2e
> 6: 0x88
> 7: 0xc0

Looks to me like you are talking to a server that's using the
integer_datetimes build option, in which the timestamp format
is int8 not double, and the unit is microseconds.

regression=# select x'9d0a6d2e88c0'::int8;
      int8
-----------------
 172668107000000
(1 row)

            regards, tom lane

pgsql-novice by date:

Previous
From: "Warren Murray"
Date:
Subject: Fatal: password authentication failed for user "xxxxxx"
Next
From: Michael Fuhr
Date:
Subject: Re: Binary Format of Timestamp