From 607b39855a56490ffbe8abc7cf404bf7b333c689 Mon Sep 17 00:00:00 2001 From: Tom Lane <tgl@sss.pgh.pa.us> Date: Thu, 2 Oct 2008 13:47:38 +0000 Subject: [PATCH] Fix improper display of fractional seconds in interval values when using --enable-integer-datetimes and a non-ISO datestyle. Ron Mayer --- src/backend/utils/adt/datetime.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/utils/adt/datetime.c b/src/backend/utils/adt/datetime.c index 21043311cef..0ec29c7cb8a 100644 --- a/src/backend/utils/adt/datetime.c +++ b/src/backend/utils/adt/datetime.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/datetime.c,v 1.194 2008/09/24 19:46:44 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/datetime.c,v 1.195 2008/10/02 13:47:38 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -3791,7 +3791,7 @@ EncodeInterval(struct pg_tm * tm, fsec_t fsec, int style, char *str) is_before = TRUE; } sprintf(cp, "%s%d.%02d secs", is_nonzero ? " " : "", - tm->tm_sec, ((int) sec) / 10000); + tm->tm_sec, abs((int) rint(sec / 10000.0))); cp += strlen(cp); #else fsec += tm->tm_sec; -- GitLab