Re: roundoff problem in time datatype

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

Tom Lane wrote:
> Dennis Bjorklund <db(at)zigo(dot)dhs(dot)org> writes:
>
>>Do the sql standard say anything on the matter?
>
>
> It doesn't seem very helpful. AFAICS, we should interpret storing
> '23:59:59.99' into a TIME(0) field as a cast from TIME(2) to TIME(0),
> and the spec defines that as
>
> 15) If TD is the datetime data type TIME WITHOUT TIME ZONE, then let
> TSP be the <time precision> of TD.
>
> 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)

Regards,
Andreas

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message David Fetter 2005-09-26 16:31:16 Re: [HACKERS] statement logging / extended query protocol
Previous Message Dennis Bjorklund 2005-09-26 16:22:17 Re: roundoff problem in time datatype

Browse pgsql-patches by date

  From Date Subject
Next Message David Fetter 2005-09-26 16:31:16 Re: [HACKERS] statement logging / extended query protocol
Previous Message Dennis Bjorklund 2005-09-26 16:22:17 Re: roundoff problem in time datatype