(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
This commit is contained in:
Assar Westerlund
1999-11-13 04:18:33 +00:00
parent a69f4cf6dc
commit 0c65782ee3

View File

@@ -348,6 +348,8 @@ strftime (char *buf, size_t maxsize, const char *format,
#if defined(HAVE_STRUCT_TM_TM_GMTOFF) #if defined(HAVE_STRUCT_TM_TM_GMTOFF)
(long)tm->tm_gmtoff (long)tm->tm_gmtoff
#elif defined(HAVE_TIMEZONE) #elif defined(HAVE_TIMEZONE)
tm->tm_isdst ?
(long)altzone :
(long)timezone (long)timezone
#else #else
#error Where in timezone chaos are you? #error Where in timezone chaos are you?
@@ -356,7 +358,16 @@ strftime (char *buf, size_t maxsize, const char *format,
break; break;
case 'Z' : case 'Z' :
ret = snprintf (buf, maxsize - n, 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; break;
case '\0' : case '\0' :
--format; --format;