*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/adt/datetime.c,v 1.147 2005/05/26 15:26:00 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/adt/datetime.c,v 1.148 2005/05/27 15:15:23 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifdef HAVE_INT64_TIMESTAMP
sprintf(str + strlen(str), ":%02d.%06d", tm->tm_sec, fsec);
#else
- sprintf(str + strlen(str), ":%013.10f", tm->tm_sec + fsec);
+ sprintf(str + strlen(str), ":%012.9f", tm->tm_sec + fsec);
#endif
- /* chop off trailing pairs of zeros... */
- while (strcmp((str + strlen(str) - 2), "00") == 0 &&
- *(str + strlen(str) - 3) != '.')
- *(str + strlen(str) - 2) = '\0';
+ TrimTrailingZeros(str);
}
else
sprintf(str + strlen(str), ":%02d", tm->tm_sec);
sprintf(cp, ".%06d", Abs(fsec));
#else
fsec += tm->tm_sec;
- sprintf(cp, ":%013.10f", fabs(fsec));
+ sprintf(cp, ":%012.9f", fabs(fsec));
#endif
TrimTrailingZeros(cp);
cp += strlen(cp);
sprintf(cp, ".%06d", Abs(fsec));
#else
fsec += tm->tm_sec;
- sprintf(cp, ":%013.10f", fabs(fsec));
+ sprintf(cp, ":%012.9f", fabs(fsec));
#endif
TrimTrailingZeros(cp);
cp += strlen(cp);
-- As of 7.4, allow time without time zone having a time zone specified
SELECT time without time zone '040506.789+08';
time
----------------
- 04:05:06.7890
+--------------
+ 04:05:06.789
(1 row)
SELECT time without time zone '040506.789-08';
time
----------------
- 04:05:06.7890
+--------------
+ 04:05:06.789
(1 row)
SELECT time without time zone 'T040506.789+08';
time
----------------
- 04:05:06.7890
+--------------
+ 04:05:06.789
(1 row)
SELECT time without time zone 'T040506.789-08';
time
----------------
- 04:05:06.7890
+--------------
+ 04:05:06.789
(1 row)
SELECT time with time zone '040506.789+08';
timetz
-------------------
- 04:05:06.7890+08
+-----------------
+ 04:05:06.789+08
(1 row)
SELECT time with time zone '040506.789-08';
timetz
-------------------
- 04:05:06.7890-08
+-----------------
+ 04:05:06.789-08
(1 row)
SELECT time with time zone 'T040506.789+08';
timetz
-------------------
- 04:05:06.7890+08
+-----------------
+ 04:05:06.789+08
(1 row)
SELECT time with time zone 'T040506.789-08';
timetz
-------------------
- 04:05:06.7890-08
+-----------------
+ 04:05:06.789-08
(1 row)
SELECT time with time zone 'T040506.789 +08';
timetz
-------------------
- 04:05:06.7890+08
+-----------------
+ 04:05:06.789+08
(1 row)
SELECT time with time zone 'T040506.789 -08';
timetz
-------------------
- 04:05:06.7890-08
+-----------------
+ 04:05:06.789-08
(1 row)
SET DateStyle = 'Postgres, MDY';
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <stdarg.h>
-#include "../../include/c.h"
+#if defined(WIN32) || defined(__CYGWIN__)
+#define PG_BINARY_R "rb"
+#else
+#define PG_BINARY_R "r"
+#endif
#define NUL '\0'
extern int optind;
int
-main(argc, argv)
-int argc;
-char **argv;
+main(int argc, char **argv)
{
int tab_size = 8,
min_spaces = 2,
/*VARARGS*/
void
-halt(const char *path, ...)
+halt(const char *format, ...)
{
va_list arg_ptr;
- char *format,
- *pstr;
+ const char *pstr;
void (*sig_func) ();
- va_start(arg_ptr, path);
- format = va_arg(arg_ptr, char *);
+ va_start(arg_ptr, format);
if (strncmp(format, "PERROR", 6) != 0)
vfprintf(stderr, format, arg_ptr);
else