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

Ron Mayer

src/backend/utils/adt/datetime.c

index 17ec09780c2ac410358deade32eec573c1e4c713..76040129f1a6e9989a0fb3d4d4968489331866a2 100644 (file)
@@ -3995,7 +3995,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;