From: Tom Lane <tgl@sss.pgh.pa.us>
To: Herouth Maoz <herouth@oumail.openu.ac.il>
Cc: Collin F. Lynch <clynch@water2.cs.umass.edu>
Cc: pgsql-interfaces@postgreSQL.org
Cc: pgsql-hackers@postgreSQL.org
Subject: Re: [INTERFACES] Time and microseconds?
Date: Sun, 04 Jul 1999 10:18:30 -0400
Message-ID: <17951.931097910@sss.pgh.pa.us> (raw)
In-Reply-To: <l03130301b3a4db9b4387@[147.233.159.109]>
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: tgl@sss.pgh.pa.us, herouth@oumail.openu.ac.il, clynch@water2.cs.umass.edu, pgsql-hackers@postgreSQL.org
Subject: Re: [INTERFACES] Time and microseconds?
In-Reply-To: <17951.931097910@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox