Re: roundoff problem in time datatype

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andreas Pflug <pgadmin(at)pse-consulting(dot)de>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: roundoff problem in time datatype
Date: 2005-09-26 17:00:21
Message-ID: 284.1127754021@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Andreas Pflug <pgadmin(at)pse-consulting(dot)de> writes:
> Tom Lane wrote:
>> b) If SD is TIME WITHOUT TIME ZONE, then TV is SV, with
>> implementation-defined rounding or truncation if necessary.
>>
>> So it's "implementation-defined" what we do.

> IMHO Since 23:59:59.99 probably means "the last milliseconds of this
> day, as far as precision allows to express it", this should be truncated
> to 23:59:59, not rounded to 24:00:00. Until the last microsecond has
> elapsed, it's not 24 hours (you wouldn't round "happy new year" at
> 23:59:30 from a clock with minutes only either)

Hm, so the proposal is "round unless that would produce 24:00:00, in
which case truncate"? Seems a bit ugly but it would follow the letter
of the spec, and avoid rejecting inputs that we used to accept. It's
still not very clear what to do with '23:59:60.9' though.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Joshua D. Drake 2005-09-26 17:06:41 Re: Open items list for 8.1
Previous Message David Fetter 2005-09-26 16:58:34 On Logging

Browse pgsql-patches by date

  From Date Subject
Next Message Andreas Pflug 2005-09-26 17:21:21 Re: roundoff problem in time datatype
Previous Message Bruce Momjian 2005-09-26 16:58:04 Re: Patching dblink.c to avoid warning about open transaction