Re: Binary Format of Timestamp

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Joe Joe <fondwey(at)yahoo(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: Binary Format of Timestamp
Date: 2005-06-28 06:14:17
Message-ID: 11303.1119939257@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

Joe Joe <fondwey(at)yahoo(dot)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

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Volkan YAZICI 2005-06-28 06:46:30 Re: Transactions
Previous Message Michael Fuhr 2005-06-28 06:00:20 Re: Binary Format of Timestamp