]> granicus.if.org Git - postgresql/commitdiff
Standardize output buffer size and display format for strftime;
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 22 Mar 2004 15:34:22 +0000 (15:34 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 22 Mar 2004 15:34:22 +0000 (15:34 +0000)
followup to complaint from Korean User's Group.

contrib/pg_autovacuum/pg_autovacuum.c
src/backend/utils/adt/nabstime.c
src/backend/utils/error/elog.c
src/bin/pg_controldata/pg_controldata.c

index ed59024b69dbbd708b2faa020b337cd4d8fe3223..89f0e0bf91da43fb15dcbea0cd2acda33bf9ebc2 100644 (file)
@@ -5,9 +5,8 @@
  */
 
 #include "pg_autovacuum.h"
-#define TIMEBUFF 256
+
 FILE      *LOGOUTPUT;
-char           timebuffer[TIMEBUFF];
 char           logbuffer[4096];
 
 void
@@ -15,11 +14,11 @@ log_entry(const char *logentry)
 {
        time_t          curtime;
        struct tm  *loctime;
+       char            timebuffer[128];
 
        curtime = time(NULL);
        loctime = localtime(&curtime);
-       strftime(timebuffer, TIMEBUFF, "%Y-%m-%d %r", loctime);         /* cbb - %F is not
-                                                                                                                                * always available */
+       strftime(timebuffer, sizeof(timebuffer), "%Y-%m-%d %H:%M:%S %Z", loctime);
        fprintf(LOGOUTPUT, "[%s] %s\n", timebuffer, logentry);
 }
 
index d88d1555f36911a3d2f64eb6f0c7aa9ef59edcf5..e9109938adb5c5fbc49b2fe20660a26b73fb92d2 100644 (file)
@@ -10,7 +10,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/utils/adt/nabstime.c,v 1.118 2003/11/29 19:51:58 pgsql Exp $
+ *       $PostgreSQL: pgsql/src/backend/utils/adt/nabstime.c,v 1.119 2004/03/22 15:34:22 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1724,8 +1724,8 @@ timeofday(PG_FUNCTION_ARGS)
 {
        struct timeval tp;
        struct timezone tpz;
-       char            templ[100];
-       char            buf[100];
+       char            templ[128];
+       char            buf[128];
        text       *result;
        int                     len;
 
index 8569b6ce5cffb7385702725b46d3aa4ef7a11956..37c5b36e09d65413cd63f7c71f469bc5bb15bd41 100644 (file)
@@ -37,7 +37,7 @@
  *
  *
  * IDENTIFICATION
- *       $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.130 2004/03/21 22:29:11 tgl Exp $
+ *       $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.131 2004/03/22 15:34:22 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -1187,9 +1187,9 @@ log_line_prefix(StringInfo buf)
                        case 't':
                                {
                                        time_t stamp_time = time(NULL);
-                                       char strfbuf[32];
+                                       char strfbuf[128];
 
-                                       strftime(strfbuf, sizeof(strfbuf), "%Y-%m-%d %H:%M:%S",
+                                       strftime(strfbuf, sizeof(strfbuf), "%Y-%m-%d %H:%M:%S %Z",
                                                         localtime(&stamp_time));
                                        appendStringInfoString(buf, strfbuf);
                                }
@@ -1198,9 +1198,9 @@ log_line_prefix(StringInfo buf)
                                if (MyProcPort)
                                {
                                        time_t stamp_time = MyProcPort->session_start.tv_sec;
-                                       char strfbuf[32];
+                                       char strfbuf[128];
 
-                                       strftime(strfbuf, sizeof(strfbuf), "%Y-%m-%d %H:%M:%S",
+                                       strftime(strfbuf, sizeof(strfbuf), "%Y-%m-%d %H:%M:%S %Z",
                                                         localtime(&stamp_time));
                                        appendStringInfoString(buf, strfbuf);
                                }
index 9d7549cc6864d61bd5bb53bbb1244f9e29320ab3..4342d1e10afa3143f2cbdefa81fa86d5db938a1a 100644 (file)
@@ -6,7 +6,7 @@
  * copyright (c) Oliver Elphick <olly@lfix.co.uk>, 2001;
  * licence: BSD
  *
- * $PostgreSQL: pgsql/src/bin/pg_controldata/pg_controldata.c,v 1.13 2004/02/11 22:55:25 tgl Exp $
+ * $PostgreSQL: pgsql/src/bin/pg_controldata/pg_controldata.c,v 1.14 2004/03/22 15:34:22 tgl Exp $
  */
 #include "postgres.h"
 
@@ -71,8 +71,8 @@ main(int argc, char *argv[])
        char            ControlFilePath[MAXPGPATH];
        char       *DataDir;
        crc64           crc;
-       char            pgctime_str[32];
-       char            ckpttime_str[32];
+       char            pgctime_str[128];
+       char            ckpttime_str[128];
        char            sysident_str[32];
        char       *strftime_fmt = "%c";
        char       *progname;