Re: [INTERFACES] Time and microseconds?

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [INTERFACES] Time and microseconds?
Дата
Msg-id 17951.931097910@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [INTERFACES] Time and microseconds?  (Herouth Maoz <herouth@oumail.openu.ac.il>)
Список pgsql-hackers
Herouth Maoz <herouth@oumail.openu.ac.il> writes:
> The TIME datatype is supposed to be compatible with SQL92, but it's, well,
> not exactly. Anyway, the default precision for time is 0, that is, no
> fractions of seconds unless stated so explicitly. However, since it stores
> milliseconds, it defies that definition.

Actually, datetime uses a float8 to store seconds-since-some-epoch-
or-other (from a quick look at the sources, it looks like datetime 0
is midnight GMT 1/1/2000).  That means the precision varies depending
on how far away from time zero you are talking about.  Currently,
with less than 16 million seconds left until the epoch, a standard
IEEE float8 will have about 28 bits to spare to the right of the
binary point, giving us nominal precision not much worse than
nanoseconds.  For a more reasonable time range, say up to 100 years
from the epoch, you could expect microsecond precision.

The default output routine for type datetime doesn't seem to want
to print more than 2 digits after the decimal point, but you can extract
the full fractional precision with datetime_part("second", ...).
        regards, tom lane


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] Tuple length limit
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: [HACKERS] Tuple length limit