diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2007-08-04 01:26:54 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2007-08-04 01:26:54 +0000 |
commit | bdd6b62245fe7b5f25c4fec509b80ec930b6deff (patch) | |
tree | 91af2ffde788fdd2855b0dfb1c18e2bbb5aa50a1 /src/backend/utils/adt/nabstime.c | |
parent | 73852bd520c219051431a74ee511c4f29dd4baf3 (diff) | |
download | postgresql-bdd6b62245fe7b5f25c4fec509b80ec930b6deff.tar.gz postgresql-bdd6b62245fe7b5f25c4fec509b80ec930b6deff.zip |
Switch over to using the src/timezone functions for formatting timestamps
displayed in the postmaster log. This avoids Windows-specific problems with
localized time zone names that are in the wrong encoding, and generally seems
like a good idea to forestall other potential platform-dependent issues.
To preserve the existing behavior that all backends will log in the same time
zone, create a new GUC variable log_timezone that can only be changed on a
system-wide basis, and reference log-related calculations to that zone instead
of the TimeZone variable.
This fixes the issue reported by Hiroshi Saito that timestamps printed by
xlog.c startup could be improperly localized on Windows. We still need a
simpler patch for that problem in the back branches, however.
Diffstat (limited to 'src/backend/utils/adt/nabstime.c')
-rw-r--r-- | src/backend/utils/adt/nabstime.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/backend/utils/adt/nabstime.c b/src/backend/utils/adt/nabstime.c index 3ec098a39f3..903ca5d6adf 100644 --- a/src/backend/utils/adt/nabstime.c +++ b/src/backend/utils/adt/nabstime.c @@ -10,7 +10,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/utils/adt/nabstime.c,v 1.150 2007/02/27 23:48:08 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/utils/adt/nabstime.c,v 1.151 2007/08/04 01:26:53 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -112,7 +112,7 @@ abstime2tm(AbsoluteTime _time, int *tzp, struct pg_tm * tm, char **tzn) time -= CTimeZone; if (!HasCTZSet && tzp != NULL) - tx = pg_localtime(&time, global_timezone); + tx = pg_localtime(&time, session_timezone); else tx = pg_gmtime(&time); @@ -474,7 +474,7 @@ timestamp_abstime(PG_FUNCTION_ARGS) result = NOEND_ABSTIME; else if (timestamp2tm(timestamp, NULL, tm, &fsec, NULL, NULL) == 0) { - tz = DetermineTimeZoneOffset(tm, global_timezone); + tz = DetermineTimeZoneOffset(tm, session_timezone); result = tm2abstime(tm, tz); } else @@ -1591,7 +1591,7 @@ timeofday(PG_FUNCTION_ARGS) gettimeofday(&tp, NULL); tt = (pg_time_t) tp.tv_sec; pg_strftime(templ, sizeof(templ), "%a %b %d %H:%M:%S.%%06d %Y %Z", - pg_localtime(&tt, global_timezone)); + pg_localtime(&tt, session_timezone)); snprintf(buf, sizeof(buf), templ, tp.tv_usec); len = VARHDRSZ + strlen(buf); |