Re: Decimal digits in timeofday()

Lists: pgsql-bugs
From: Nicola Larosa <nico(at)tekNico(dot)net>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Decimal digits in timeofday()
Date: 2001-10-24 13:38:57
Message-ID: 3BD6C471.2090509@tekNico.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

There's a cute little bug somewhere.

While

SELECT timeofday();

returns six decimal digits,

SELECT date_part('epoch', timeofday()::timestamp);

only returns five, on a Linux Slackware 8.0 x86 machine with PostgreSQL 7.1.1 .

Please do not make me dive into C code again, already fixed a similar bug in
Zope , but in Python (it shaved off two digits instead of one, but anyway...)

Another thing, does anyone know where I could see the docs for the new
to_timestamp microsecond-aware function in 7.2?

Lastly, thanks for the fine software. Just donated 50$ to PostgreSQL Inc.,
it feels good. :^)

--
"Mozilla will be around long after nobody can remember
just quite what Internet Explorer actually used to be."
AirLace on Slashdot

Nicola Larosa - nico(at)tekNico(dot)net


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Nicola Larosa <nico(at)tekNico(dot)net>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Decimal digits in timeofday()
Date: 2001-10-24 19:51:24
Message-ID: 22087.1003953084@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-bugs

Nicola Larosa <nico(at)tekNico(dot)net> writes:
> There's a cute little bug somewhere.

Only that the default display precision for float8 is 15 digits.

regression=# SELECT date_part('epoch', now());
date_part
------------------
1003952920.01861
(1 row)

regression=# select '1003952920.01861'::float8;
float8
------------------
1003952920.01861
(1 row)

regression=# select '1003952920.018612'::float8;
float8
------------------
1003952920.01861
(1 row)

regression=# select '1003952920.018612'::float8 - 1003952920.0;
?column?
--------------------
0.0186120271682739
(1 row)

regression=#

regards, tom lane