Re: c function returning high resolution timestamp

Поиск
Список
Период
Сортировка
От Andreas Seltenreich
Тема Re: c function returning high resolution timestamp
Дата
Msg-id 87lknb2jvu.fsf@gate450.dyndns.org
обсуждение исходный текст
Ответ на c function returning high resolution timestamp  (Ron Peterson <ron.peterson@yellowbank.com>)
Ответы Re: c function returning high resolution timestamp  (Ron Peterson <ron.peterson@yellowbank.com>)
Список pgsql-general
Ron Peterson writes:

> On Wed, Oct 18, 2006 at 04:43:40PM -0400, Ron Peterson wrote:
> I'm pretty close, but I'm still not understanding something about
> PostgreSQL's internal timestamp representation.  If I do 'select
> now();', I get a return value with microsecond resolution, which would
> seem to indicate that internally, PostgreSQL is using an INT64 value
> rather than a float to hold the timestamp.

Floating point timestamps /do/ have microsecond resolution over a
limited range:

,----[ <http://www.postgresql.org/docs/8.1/static/datatype-datetime.html> ]
| Microsecond precision is achieved for dates within a few years of
| 2000-01-01, but the precision degrades for dates further away. When
| timestamp values are stored as eight-byte integers (a compile-time
| option), microsecond precision is available over the full range of
| values.
`----

> My function below, however, always takes the float path through the
> ifdef.  If I force the int64 path, I just get a garbage timestamp
> which still only has a seconds resolution.

The proper way to enable the int64 path is enabling integer timestamps
during build-time:

,----[ ./configure --help|grep time ]
|   --enable-integer-datetimes  enable 64-bit integer date/time support
`----

regards,
andreas

В списке pgsql-general по дате отправления:

Предыдущее
От: Alvaro Herrera
Дата:
Сообщение: Re: why not kill -9 postmaster
Следующее
От: "Harald Armin Massa"
Дата:
Сообщение: Re: why not kill -9 postmaster