aboutsummaryrefslogtreecommitdiff
path: root/src/timezone/strftime.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2017-04-30 15:13:51 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2017-04-30 15:14:11 -0400
commit4d4d8fa77eb81c949dc52ffcb401a476fffddb2c (patch)
treef64f793b4600220a7b9f2b5c47545a608455ea53 /src/timezone/strftime.c
parenta0291c33070d7095bc8aa4f21a1f6ccf714b262f (diff)
downloadpostgresql-4d4d8fa77eb81c949dc52ffcb401a476fffddb2c.tar.gz
postgresql-4d4d8fa77eb81c949dc52ffcb401a476fffddb2c.zip
Sync our copy of the timezone library with IANA release tzcode2017b.
zic no longer mishandles some transitions in January 2038 when it attempts to work around Qt bug 53071. This fixes a bug affecting Pacific/Tongatapu that was introduced in zic 2016e. localtime.c now contains a workaround, useful when loading a file generated by a buggy zic. There are assorted cosmetic changes as well, notably relocation of a bunch of #defines.
Diffstat (limited to 'src/timezone/strftime.c')
-rw-r--r--src/timezone/strftime.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/timezone/strftime.c b/src/timezone/strftime.c
index 4a0a01db651..ab8f60e9c8f 100644
--- a/src/timezone/strftime.c
+++ b/src/timezone/strftime.c
@@ -1,4 +1,4 @@
-/* Convert a broken-down time stamp to a string. */
+/* Convert a broken-down timestamp to a string. */
/*
* Copyright 1989 The Regents of the University of California.
@@ -44,7 +44,6 @@
#include <locale.h>
#include "private.h"
-#include "tzfile.h"
struct lc_time_T
@@ -452,11 +451,17 @@ _fmt(const char *format, const struct pg_tm * t, char *pt, const char *ptlim,
{
long diff;
char const *sign;
+ bool negative;
if (t->tm_isdst < 0)
continue;
diff = t->tm_gmtoff;
- if (diff < 0)
+ negative = diff < 0;
+ if (diff == 0)
+ {
+ negative = t->tm_zone[0] == '-';
+ }
+ if (negative)
{
sign = "-";
diff = -diff;