summaryrefslogtreecommitdiff
path: root/lib/strftime.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2015-07-25 16:37:17 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2015-07-25 18:20:13 -0700
commitfe699d375f07faf11ce057c9585327c6bdb05af4 (patch)
tree7fd3c8051c152894a94096b5eb4a9380f6e06f4a /lib/strftime.c
parentc1340b3d346b6a76f75f59828f4d73400c56bc85 (diff)
downloadgnulib-fe699d375f07faf11ce057c9585327c6bdb05af4.tar.gz
strftime: fix newly-introduced bug on Solaris
* lib/strftime.c (strftime_case_): Set the local variable 'zone' consistently at the start, rather than doing some of the setup at the start and some in the %Z format spec. This is cleaner, and works better with time_rz on platforms like Solaris where struct tm lacks a tm_zone member, as when !HAVE_TM_GMTOFF %z's calls to mktime_z and localtime_rz can mess up the tzname cache.
Diffstat (limited to 'lib/strftime.c')
-rw-r--r--lib/strftime.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/lib/strftime.c b/lib/strftime.c
index 3cc8477a59..c7cec2621c 100644
--- a/lib/strftime.c
+++ b/lib/strftime.c
@@ -481,7 +481,12 @@ strftime_case_ (bool upcase, STREAM_OR_CHAR_T *s,
tzset ();
# endif
}
+ /* The tzset() call might have changed the value. */
+ if (!(zone && *zone) && tp->tm_isdst >= 0)
+ zone = tzname[tp->tm_isdst != 0];
#endif
+ if (! zone)
+ zone = "";
if (hour12 > 12)
hour12 -= 12;
@@ -1304,14 +1309,6 @@ strftime_case_ (bool upcase, STREAM_OR_CHAR_T *s,
to_lowcase = true;
}
-#if HAVE_TZNAME
- /* The tzset() call might have changed the value. */
- if (!(zone && *zone) && tp->tm_isdst >= 0)
- zone = tzname[tp->tm_isdst != 0];
-#endif
- if (! zone)
- zone = "";
-
#ifdef COMPILE_WIDE
{
/* The zone string is always given in multibyte form. We have