summaryrefslogtreecommitdiff
path: root/src/timezone/strftime.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/timezone/strftime.c')
-rw-r--r--src/timezone/strftime.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/timezone/strftime.c b/src/timezone/strftime.c
index 5630619321..3f6ba395c6 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.
@@ -41,10 +41,8 @@
#include "postgres.h"
#include <fcntl.h>
-#include <locale.h>
#include "private.h"
-#include "tzfile.h"
struct lc_time_T
@@ -128,7 +126,7 @@ pg_strftime(char *s, size_t maxsize, const char *format,
int warn;
warn = IN_NONE;
- p = _fmt(((format == NULL) ? "%c" : format), t, s, s + maxsize, &warn);
+ p = _fmt(format, t, s, s + maxsize, &warn);
if (p == s + maxsize)
return 0;
*p = '\0';
@@ -452,11 +450,18 @@ _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)
+ {
+ if (t->tm_zone != NULL)
+ negative = t->tm_zone[0] == '-';
+ }
+ if (negative)
{
sign = "-";
diff = -diff;