2016-03-06 1:23 GMT+03:00 Christian Weisgerber <[email protected]>:
> > It looks like decided to use TM_ZONE as a wrapper for tm.tm_zone,
> > until the tm_zone is gone. So, until the later happens (I found
> > no usage of tm_zone in base, BTW), we should at least use TM_ZONE
> > consistently. Okay for the patch?
>
> ok naddy@
>
> Note that tm_gmtoff is wrapped the same way by TM_GMTOFF, and there
> is a similar inconsistent use of tm_gmtoff in wcsftime.c
You're absolutely right. Here is an updated patch.
Since %z relies on tm_gmtoff, all we can do is to expand %z to empty
string, as specified in strftime(3).
Okay for this version?
--
WBR,
Vadim Zhukov
Index: wcsftime.c
===================================================================
RCS file: /cvs/src/lib/libc/time/wcsftime.c,v
retrieving revision 1.6
diff -u -p -r1.6 wcsftime.c
--- wcsftime.c 9 Feb 2015 14:52:28 -0000 1.6
+++ wcsftime.c 6 Mar 2016 12:12:16 -0000
@@ -438,9 +438,11 @@ label:
pt = _yconv(t->tm_year, TM_YEAR_BASE, 1, 1, pt, ptlim);
continue;
case 'Z':
- if (t->tm_zone != NULL)
+#ifdef TM_ZONE
+ if (t->TM_ZONE != NULL)
pt = _sadd(t->TM_ZONE, pt, ptlim);
else
+#endif
if (t->tm_isdst >= 0)
pt = _sadd(tzname[t->tm_isdst != 0],
pt, ptlim);
@@ -451,13 +453,14 @@ label:
*/
continue;
case 'z':
+#ifdef TM_GMTOFF
{
int diff;
wchar_t const * sign;
if (t->tm_isdst < 0)
continue;
- diff = t->tm_gmtoff;
+ diff = t->TM_GMTOFF;
if (diff < 0) {
sign = L"-";
diff = -diff;
@@ -469,6 +472,7 @@ label:
(diff % MINSPERHOUR);
pt = _conv(diff, L"%04d", pt, ptlim);
}
+#endif
continue;
case '+':
pt = _fmt(Locale->date_fmt, t, pt, ptlim, warnp);