summaryrefslogtreecommitdiff
path: root/src/include/utils/timestamp.h
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2005-10-09 17:21:47 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2005-10-09 17:21:47 +0000
commit313ed1ed9498f977262e180a080c7748197ced5c (patch)
tree17780e929d9a0d710d84de261b27ac26e9a5adcf /src/include/utils/timestamp.h
parent7754f7634cbc837702428bbb40a0efbeec7a51d1 (diff)
Fix (hopefully for the last time) problems with datetime values displaying
like '23:59:60' because of fractional-second roundoff problems. Trying to control this upstream of the actual display code was hopeless; the right way is to explicitly round fractional seconds in the display code and then refigure the results if the fraction rounds up to 1. Per bug #1927.
Diffstat (limited to 'src/include/utils/timestamp.h')
-rw-r--r--src/include/utils/timestamp.h9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/include/utils/timestamp.h b/src/include/utils/timestamp.h
index 14c8f6c91b9..dc218f3b28f 100644
--- a/src/include/utils/timestamp.h
+++ b/src/include/utils/timestamp.h
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/utils/timestamp.h,v 1.55 2005/10/07 20:13:16 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/utils/timestamp.h,v 1.56 2005/10/09 17:21:47 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -163,8 +163,11 @@ typedef int32 fsec_t;
typedef double fsec_t;
-#define TIME_PREC_INV 1000000.0
-#define JROUND(j) (rint(((double) (j)) * TIME_PREC_INV) / TIME_PREC_INV)
+/* round off to MAX_TIMESTAMP_PRECISION decimal places */
+/* note: this is also used for rounding off intervals */
+#define TS_PREC_INV 1000000.0
+#define TSROUND(j) (rint(((double) (j)) * TS_PREC_INV) / TS_PREC_INV)
+
#endif
#define TIMESTAMP_MASK(b) (1 << (b))