Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4c862b1

Browse files
committed
Display only 9 not 10 digits of precision for timestamp values when
using non-integer timestamps. This prevents the display of roundingerrors for common values like days < 32.
1 parentb3195da commit4c862b1

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.145 2005/05/2602:04:13 neilc Exp $
11+
* $PostgreSQL: pgsql/src/backend/utils/adt/datetime.c,v 1.146 2005/05/2603:48:25 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -3461,7 +3461,7 @@ EncodeTimeOnly(struct pg_tm * tm, fsec_t fsec, int *tzp, int style, char *str)
34613461
#ifdefHAVE_INT64_TIMESTAMP
34623462
sprintf(str+strlen(str),":%02d.%06d",tm->tm_sec,fsec);
34633463
#else
3464-
sprintf(str+strlen(str),":%013.10f",tm->tm_sec+fsec);
3464+
sprintf(str+strlen(str),":%012.9f",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,":%013.10f",fabs(fsec));
3807+
sprintf(cp,":%012.9f",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,":%013.10f",fabs(fsec));
514+
sprintf(cp,":%012.9f",fabs(fsec));
515515
#endif
516516
TrimTrailingZeros(cp);
517517
cp+=strlen(cp);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp