Back out part of patch that should be applied later.

This commit is contained in:
Bruce Momjian 2005-05-27 15:16:45 +00:00
parent 22f0303023
commit fbdb203a39
3 changed files with 28 additions and 25 deletions

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/adt/datetime.c,v 1.148 2005/05/27 15:15:23 momjian Exp $ * $PostgreSQL: pgsql/src/backend/utils/adt/datetime.c,v 1.149 2005/05/27 15:16:44 momjian Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
@ -3461,9 +3461,12 @@ EncodeTimeOnly(struct pg_tm * tm, fsec_t fsec, int *tzp, int style, char *str)
#ifdef HAVE_INT64_TIMESTAMP #ifdef HAVE_INT64_TIMESTAMP
sprintf(str + strlen(str), ":%02d.%06d", tm->tm_sec, fsec); sprintf(str + strlen(str), ":%02d.%06d", tm->tm_sec, fsec);
#else #else
sprintf(str + strlen(str), ":%012.9f", tm->tm_sec + fsec); sprintf(str + strlen(str), ":%013.10f", tm->tm_sec + fsec);
#endif #endif
TrimTrailingZeros(str); /* chop off trailing pairs of zeros... */
while (strcmp((str + strlen(str) - 2), "00") == 0 &&
*(str + strlen(str) - 3) != '.')
*(str + strlen(str) - 2) = '\0';
} }
else else
sprintf(str + strlen(str), ":%02d", tm->tm_sec); sprintf(str + strlen(str), ":%02d", tm->tm_sec);
@ -3801,7 +3804,7 @@ EncodeInterval(struct pg_tm * tm, fsec_t fsec, int style, char *str)
sprintf(cp, ".%06d", Abs(fsec)); sprintf(cp, ".%06d", Abs(fsec));
#else #else
fsec += tm->tm_sec; fsec += tm->tm_sec;
sprintf(cp, ":%012.9f", fabs(fsec)); sprintf(cp, ":%013.10f", fabs(fsec));
#endif #endif
TrimTrailingZeros(cp); TrimTrailingZeros(cp);
cp += strlen(cp); cp += strlen(cp);

View File

@ -511,7 +511,7 @@ EncodeInterval(struct tm * tm, fsec_t fsec, int style, char *str)
sprintf(cp, ".%06d", Abs(fsec)); sprintf(cp, ".%06d", Abs(fsec));
#else #else
fsec += tm->tm_sec; fsec += tm->tm_sec;
sprintf(cp, ":%012.9f", fabs(fsec)); sprintf(cp, ":%013.10f", fabs(fsec));
#endif #endif
TrimTrailingZeros(cp); TrimTrailingZeros(cp);
cp += strlen(cp); cp += strlen(cp);

View File

@ -205,62 +205,62 @@ SET DateStyle = 'ISO';
-- As of 7.4, allow time without time zone having a time zone specified -- As of 7.4, allow time without time zone having a time zone specified
SELECT time without time zone '040506.789+08'; SELECT time without time zone '040506.789+08';
time time
-------------- ---------------
04:05:06.789 04:05:06.7890
(1 row) (1 row)
SELECT time without time zone '040506.789-08'; SELECT time without time zone '040506.789-08';
time time
-------------- ---------------
04:05:06.789 04:05:06.7890
(1 row) (1 row)
SELECT time without time zone 'T040506.789+08'; SELECT time without time zone 'T040506.789+08';
time time
-------------- ---------------
04:05:06.789 04:05:06.7890
(1 row) (1 row)
SELECT time without time zone 'T040506.789-08'; SELECT time without time zone 'T040506.789-08';
time time
-------------- ---------------
04:05:06.789 04:05:06.7890
(1 row) (1 row)
SELECT time with time zone '040506.789+08'; SELECT time with time zone '040506.789+08';
timetz timetz
----------------- ------------------
04:05:06.789+08 04:05:06.7890+08
(1 row) (1 row)
SELECT time with time zone '040506.789-08'; SELECT time with time zone '040506.789-08';
timetz timetz
----------------- ------------------
04:05:06.789-08 04:05:06.7890-08
(1 row) (1 row)
SELECT time with time zone 'T040506.789+08'; SELECT time with time zone 'T040506.789+08';
timetz timetz
----------------- ------------------
04:05:06.789+08 04:05:06.7890+08
(1 row) (1 row)
SELECT time with time zone 'T040506.789-08'; SELECT time with time zone 'T040506.789-08';
timetz timetz
----------------- ------------------
04:05:06.789-08 04:05:06.7890-08
(1 row) (1 row)
SELECT time with time zone 'T040506.789 +08'; SELECT time with time zone 'T040506.789 +08';
timetz timetz
----------------- ------------------
04:05:06.789+08 04:05:06.7890+08
(1 row) (1 row)
SELECT time with time zone 'T040506.789 -08'; SELECT time with time zone 'T040506.789 -08';
timetz timetz
----------------- ------------------
04:05:06.789-08 04:05:06.7890-08
(1 row) (1 row)
SET DateStyle = 'Postgres, MDY'; SET DateStyle = 'Postgres, MDY';