Skip to content

Commit f35d493

Browse files
committed
Back out:
Display only 9 not 10 digits of precision for timestamp values when using non-integer timestamps. This prevents the display of rounding errors for common values like days < 32.
1 parent dabde32 commit f35d493

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/backend/utils/adt/datetime.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/utils/adt/datetime.c,v 1.146 2005/05/26 03:48:25 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/utils/adt/datetime.c,v 1.147 2005/05/26 15:26:00 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -3461,7 +3461,7 @@ EncodeTimeOnly(struct pg_tm * tm, fsec_t fsec, int *tzp, int style, char *str)
34613461
#ifdef HAVE_INT64_TIMESTAMP
34623462
sprintf(str + strlen(str), ":%02d.%06d", tm->tm_sec, fsec);
34633463
#else
3464-
sprintf(str + strlen(str), ":%012.9f", tm->tm_sec + fsec);
3464+
sprintf(str + strlen(str), ":%013.10f", tm->tm_sec + fsec);
34653465
#endif
34663466
/* chop off trailing pairs of zeros... */
34673467
while (strcmp((str + strlen(str) - 2), "00") == 0 &&
@@ -3804,7 +3804,7 @@ EncodeInterval(struct pg_tm * tm, fsec_t fsec, int style, char *str)
38043804
sprintf(cp, ".%06d", Abs(fsec));
38053805
#else
38063806
fsec += tm->tm_sec;
3807-
sprintf(cp, ":%012.9f", fabs(fsec));
3807+
sprintf(cp, ":%013.10f", fabs(fsec));
38083808
#endif
38093809
TrimTrailingZeros(cp);
38103810
cp += strlen(cp);

src/interfaces/ecpg/pgtypeslib/interval.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ EncodeInterval(struct tm * tm, fsec_t fsec, int style, char *str)
511511
sprintf(cp, ".%06d", (fsec >= 0) ? fsec : -(fsec));
512512
#else
513513
fsec += tm->tm_sec;
514-
sprintf(cp, ":%012.9f", fabs(fsec));
514+
sprintf(cp, ":%013.10f", fabs(fsec));
515515
#endif
516516
TrimTrailingZeros(cp);
517517
cp += strlen(cp);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy