Subject: Re: lib/10950: strftime(3) ignores tm_zone when processing %Z
To: None <gnats-bugs@gnats.netbsd.org>
From: Takahiro Kambe <taca@sky.yamashina.kyoto.jp>
List: netbsd-bugs
Date: 09/06/2000 08:45:36
In message <200009050549.e855nQl22165@edge.sky.yamashina.kyoto.jp>
	on Tue, 5 Sep 2000 14:49:26 +0900 (JST),
	Takahiro Kambe <taca@sky.yamashina.kyoto.jp> wrote:
> >Fix:
> 	Fix strftime(3) to honor tm_zone filed.
Here is simle fix based on OpenBSD's code.

--- strftime.c.orig	Mon Mar 20 23:36:45 2000
+++ strftime.c	Wed Sep  6 08:36:03 2000
@@ -43,6 +43,7 @@
 #endif /* LIBC_SCCS and not lint */
 
 #include "namespace.h"
+#include "private.h"
 #include <sys/localedef.h>
 #include <locale.h>
 #include <string.h>
@@ -348,6 +349,12 @@
 					return (0);
 				continue;
 			case 'Z':
+#ifdef TM_ZONE
+				if (t->TM_ZONE != NULL) {
+					if (!_add(t->TM_ZONE, pt, ptlim))
+						return (0);
+				} else
+#endif /* TM_ZONE */
 				if (tzname[t->tm_isdst ? 1 : 0] &&
 				    !_add(tzname[t->tm_isdst ? 1 : 0], pt,
 				    ptlim))