Re: patch for datetime.c

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Joseph Shraibman <jks(at)selectacast(dot)net>
Cc: "pgsql-patches(at)postgresql(dot)org" <pgsql-patches(at)postgresql(dot)org>
Subject: Re: patch for datetime.c
Date: 2001-05-04 20:11:15
Message-ID: 27775.989007075@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Joseph Shraibman <jks(at)selectacast(dot)net> writes:
> [root(at)d1 ~/postgresql-7.1/src/backend/utils/adt] diff -C 3
> datetime.c.orig datetime.c
> *** datetime.c.orig Thu May 3 21:16:37 2001
> --- datetime.c Thu May 3 21:19:51 2001
> ***************
> *** 2087,2092 ****
> --- 2087,2096 ----

> sec = (tm->tm_sec + fsec);

> + if (sec >= 59.995)
> + sec = 59.99; /* Round down to avoid times like
> 2001-05-03 21:18:60.00-04 */
> +
> +
> switch (style)
> {
> /* compatible with ISO date formats */

This is a horrid solution.

The correct solution is to round the original timestamp to two
fractional digits before it's ever broken down into y/m/d/h/m/s.

At least if you only want two digits of precision. I think Thomas
has been resisting making that change because he wants to allow
displaying more than two digits, instead.

BTW, is there really only one routine with this problem?

regards, tom lane

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Joseph Shraibman 2001-05-04 20:38:48 Re: patch for datetime.c
Previous Message Bruce Momjian 2001-05-04 17:30:08 Re: dbf2pg improvements (password, charset convertions,etc.)