From 9b43d73b3f9bef276a46660920a01f0421c4323a Mon Sep 17 00:00:00 2001 From: Bruce Momjian Date: Tue, 28 Apr 2015 21:02:57 -0400 Subject: [PATCH] to_char(): have format 'OF' only show the leading negative sign Previously both hours and minutes displayed as negative. Report by David Pozsar --- src/backend/utils/adt/formatting.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/utils/adt/formatting.c b/src/backend/utils/adt/formatting.c index 40a353f513..576db95c1b 100644 --- a/src/backend/utils/adt/formatting.c +++ b/src/backend/utils/adt/formatting.c @@ -2507,7 +2507,7 @@ DCH_to_char(FormatNode *node, bool is_interval, TmToChar *in, char *out, Oid col s += strlen(s); if (tm->tm_gmtoff % SECS_PER_HOUR != 0) { - sprintf(s, ":%02ld", (tm->tm_gmtoff % SECS_PER_HOUR) / SECS_PER_MINUTE); + sprintf(s, ":%02ld", abs(tm->tm_gmtoff % SECS_PER_HOUR) / SECS_PER_MINUTE); s += strlen(s); } break;