From 50cafab5d86559b9a5c72f26817853784449b73a Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 10 Sep 2014 23:27:27 -0700 Subject: [PROPOSED PATCH 3/4] Fix 2014g zdump regression on platforms without TM_ZONE. Problem reported by Tim Parenti in: http://mm.icann.org/pipermail/tz/2014-September/021585.html * zdump.c (localtime_r, localtime_rz) [!TM_ZONE]: Just call 'localtime', since this can set tzname in a timestamp-dependent way, which is better for zdump. * NEWS: Document this. --- NEWS | 3 ++- zdump.c | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index ab751e7..0e58e97 100644 --- a/NEWS +++ b/NEWS @@ -18,7 +18,8 @@ Unreleased, experimental changes Changes affecting code The tz library's localtime and mktime functions now set tzname to a value - appropriate for the requested time stamp, fixing a 2014g regression. + appropriate for the requested time stamp, and zdump now uses this + on platforms not defining TM_ZONE, fixing a 2014g regression. (Thanks to Tim Parenti for reporting the problem.) zdump -c no longer mishandles transitions near year boundaries. diff --git a/zdump.c b/zdump.c index 3dfa768..0735c2a 100644 --- a/zdump.c +++ b/zdump.c @@ -304,9 +304,12 @@ sumsize(size_t a, size_t b) static void tzset(void) { } #endif -#if ! HAVE_LOCALTIME_RZ +/* Platforms with TM_ZONE don't need tzname, so they can use the + faster localtime_rz or localtime_r if available. */ + +#if !defined TM_ZONE || ! HAVE_LOCALTIME_RZ -# if ! HAVE_LOCALTIME_R || ! HAVE_TZSET +# if !defined TM_ZONE || ! HAVE_LOCALTIME_R || ! HAVE_TZSET # undef localtime_r # define localtime_r zdump_localtime_r static struct tm * -- 1.9.3