From: | Jerome Wagner <jerome(dot)wagner(at)laposte(dot)net> |
---|---|
To: | Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at> |
Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Converting a TimestampTz into a C# DateTime |
Date: | 2016-11-14 15:16:09 |
Message-ID: | CA+=V_fMhLGf7naAuv62NQKqAOn8ZYkpm8ObpYcRu_bK74nF-wQ@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hello,
seeing you answer I have a question for which I found no answer a few weeks
ago : is there a way to know at runtime which internal representation
timestamps have ?
I am trying to deal with the COPY binary protocol with only SQL access to
the remote server and would like to find a way to know the internal
representation to read / write the correct timestamps.
Thanks for your help !
On Mon, Nov 14, 2016 at 1:12 PM, Albe Laurenz <laurenz(dot)albe(at)wien(dot)gv(dot)at>
wrote:
> valeriof wrote:
> > I'm handling a TimestampTz value inside a plugin to stream WAL changes
> to a
> > .NET client application. What I'm trying to do is to return all possible
> > column changes as binary (don't like to have Postgres handle the
> conversion
> > to string as I may need to have access to the bytes at the client
> level). In
> > case of a TimestampTz, is it possible to return the 8-bytes long integer
> and
> > then from the C# application convert the value to Ticks?
>
> Sure, if you know how it is stored internally.
>
> One of your problems will be that the format depends on whether PostgreSQL
> was configured with --disable-integer-datetimes or not.
>
> With that switch, a timestamp is a double precision value, otherwise a
> 64-bit integer value. In the former case, it measures seconds after
> midnight 2000-01-01, while in the latter case it measures microseconds
> after that timestamp.
>
> Yours,
> Laurenz Albe
>
> --
> Sent via pgsql-general mailing list (pgsql-general(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-general
>
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2016-11-14 15:36:17 | Re: Converting a TimestampTz into a C# DateTime |
Previous Message | Adrian Klaver | 2016-11-14 15:14:39 | Re: Syncing Data of data type BLOB into Postgres- Bytea |