From 0c65782ee3ffbd500a2ca36ea295bc1f74ac4f13 Mon Sep 17 00:00:00 2001 From: Assar Westerlund Date: Sat, 13 Nov 1999 04:18:33 +0000 Subject: [PATCH] (strftime): handle `%z' and `%Z' in a tm_gmtoff-less world git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@7377 ec53bebd-3082-4978-b11e-865c3cabbd6b --- lib/roken/strftime.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/lib/roken/strftime.c b/lib/roken/strftime.c index 2ed50df54..87fb4228b 100644 --- a/lib/roken/strftime.c +++ b/lib/roken/strftime.c @@ -348,6 +348,8 @@ strftime (char *buf, size_t maxsize, const char *format, #if defined(HAVE_STRUCT_TM_TM_GMTOFF) (long)tm->tm_gmtoff #elif defined(HAVE_TIMEZONE) + tm->tm_isdst ? + (long)altzone : (long)timezone #else #error Where in timezone chaos are you? @@ -356,7 +358,16 @@ strftime (char *buf, size_t maxsize, const char *format, break; case 'Z' : ret = snprintf (buf, maxsize - n, - "%s", tm->tm_zone); + "%s", + +#if defined(HAVE_STRUCT_TM_TM_ZONE) + tm->tm_zone +#elif defined(HAVE_TIMEZONE) + tzname[tm->tm_isdst] +#else +#error what? +#endif + ); break; case '\0' : --format;