From 17edb8405633b8a290dd549aa3cbabbfe7ff0f96 Mon Sep 17 00:00:00 2001
From: Tom Lane <tgl@sss.pgh.pa.us>
Date: Sun, 23 May 2004 23:26:53 +0000
Subject: [PATCH] Seems we had the wrong sign convention for the default
 Etc/GMTx zone names.  Per report from Alvaro.

---
 src/timezone/pgtz.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/timezone/pgtz.c b/src/timezone/pgtz.c
index bc3b0ef0eb6..6a2a84279a2 100644
--- a/src/timezone/pgtz.c
+++ b/src/timezone/pgtz.c
@@ -6,7 +6,7 @@
  * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
  *
  * IDENTIFICATION
- *	  $PostgreSQL: pgsql/src/timezone/pgtz.c,v 1.12 2004/05/23 22:24:08 tgl Exp $
+ *	  $PostgreSQL: pgsql/src/timezone/pgtz.c,v 1.13 2004/05/23 23:26:53 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -219,9 +219,14 @@ identify_system_timezone(void)
 	if (try_timezone(__tzbuf, &tt, dst_found))
 		return __tzbuf;
 
-	/* Did not find the timezone. Fallback to try a GMT zone. */
+	/*
+	 * Did not find the timezone.  Fallback to try a GMT zone.  Note that the
+	 * zic timezone database names the GMT-offset zones in POSIX style: plus
+	 * is west of Greenwich.  It's unfortunate that this is opposite of SQL
+	 * conventions.  Should we therefore change the names?  Probably not...
+	 */
 	sprintf(__tzbuf, "Etc/GMT%s%d",
-			(-tt.std_ofs < 0) ? "+" : "", tt.std_ofs / 3600);
+			(-tt.std_ofs > 0) ? "+" : "", -tt.std_ofs / 3600);
 	ereport(LOG,
 	 (errmsg("could not recognize system timezone, defaulting to \"%s\"",
 			 __tzbuf),
-- 
GitLab