Fix improper display of fractional seconds in interval values
authorTom Lane <[email protected]>
Thu, 2 Oct 2008 13:48:12 +0000 (13:48 +0000)
committerTom Lane <[email protected]>
Thu, 2 Oct 2008 13:48:12 +0000 (13:48 +0000)
when using --enable-integer-datetimes and a non-ISO datestyle.

Ron Mayer

src/backend/utils/adt/datetime.c

index 61fc5559952e33379f82c8b9c0c23da743d0937d..f25e3c6ae10b426b126260ae91f25378f39c1393 100644 (file)
@@ -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;