mirror of
https://github.com/postgres/postgres.git
synced 2025-12-21 05:21:08 +03:00
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.
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user