4242 *
4343 *
4444 * IDENTIFICATION
45- * $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.160 2005/06/1016:23:10 neilc Exp $
45+ * $PostgreSQL: pgsql/src/backend/utils/error/elog.c,v 1.161 2005/06/1020:48:54 tgl Exp $
4646 *
4747 *-------------------------------------------------------------------------
4848 */
@@ -1333,10 +1333,7 @@ log_line_prefix(StringInfo buf)
13331333/* go to char after '%' */
13341334i ++ ;
13351335if (i >=format_len )
1336- {
1337- /* format error - ignore it */
1338- break ;
1339- }
1336+ break ;/* format error - ignore it */
13401337
13411338/* process the option */
13421339switch (Log_line_prefix [i ])
@@ -1377,8 +1374,18 @@ log_line_prefix(StringInfo buf)
13771374break ;
13781375case 'm' :
13791376{
1377+ /*
1378+ * Note: for %m, %t, and %s we deliberately use the
1379+ * C library's strftime/localtime, and not the
1380+ * equivalent functions from src/timezone.This
1381+ * ensures that all backends will report log entries
1382+ * in the same timezone, namely whatever C-library
1383+ * setting they inherit from the postmaster. If we
1384+ * used src/timezone then local settings of the
1385+ * TimeZone GUC variable would confuse the log.
1386+ */
13801387time_t stamp_time ;
1381- char strfbuf [128 ],msbuf [5 ];
1388+ char strfbuf [128 ],msbuf [8 ];
13821389struct timeval tv ;
13831390
13841391gettimeofday (& tv ,NULL );
@@ -1388,32 +1395,21 @@ log_line_prefix(StringInfo buf)
13881395/* leave room for milliseconds... */
13891396/* Win32 timezone names are too long so don't print them. */
13901397#ifndef WIN32
1391- "%Y-%m-%d %H:%M:%S %Z" ,
1398+ "%Y-%m-%d %H:%M:%S %Z" ,
13921399#else
1393- "%Y-%m-%d %H:%M:%S " ,
1400+ "%Y-%m-%d %H:%M:%S " ,
13941401#endif
1395- localtime (& stamp_time ));
1402+ localtime (& stamp_time ));
13961403
13971404/* 'paste' milliseconds into place... */
1398- sprintf (msbuf ,".%03d" ,
1399- (int )(tv .tv_usec /1000 ));
1405+ sprintf (msbuf ,".%03d" , (int ) (tv .tv_usec /1000 ));
14001406strncpy (strfbuf + 19 ,msbuf ,4 );
14011407
14021408appendStringInfoString (buf ,strfbuf );
14031409}
14041410break ;
14051411case 't' :
14061412{
1407- /*
1408- * Note: for %t and %s we deliberately use the C
1409- * library's strftime/localtime, and not the
1410- * equivalent functions from src/timezone.This
1411- * ensures that all backends will report log entries
1412- * in the same timezone, namely whatever C-library
1413- * setting they inherit from the postmaster. If we
1414- * used src/timezone then local settings of the
1415- * TimeZone GUC variable would confuse the log.
1416- */
14171413time_t stamp_time = time (NULL );
14181414char strfbuf [128 ];
14191415