4 #include "locale_impl.h"
7 size_t __wcsftime_l(wchar_t *restrict s
, size_t n
, const wchar_t *restrict f
, const struct tm
*restrict tm
, locale_t loc
)
28 if (*f
== '-' || *f
== '_' || *f
== '0') pad
= *f
++;
29 if ((plus
= (*f
== '+'))) f
++;
30 width
= wcstoul(f
, &p
, 10);
31 if (*p
== 'C' || *p
== 'F' || *p
== 'G' || *p
== 'Y') {
32 if (!width
&& p
!=f
) width
= 1;
37 if (*f
== 'E' || *f
== 'O') f
++;
38 t_mb
= __strftime_fmt_1(&buf
, &k
, *f
, tm
, loc
, pad
);
40 k
= mbstowcs(wbuf
, t_mb
, sizeof wbuf
/ sizeof *wbuf
);
41 if (k
== (size_t)-1) return 0;
44 for (; *t
=='+' || *t
=='-' || (*t
=='0'&&t
[1]); t
++, k
--);
46 if (plus
&& tm
->tm_year
>= 10000-1900)
48 else if (tm
->tm_year
< -1900)
52 for (; width
> k
&& l
< n
; width
--)
55 if (k
>= n
-l
) k
= n
-l
;
66 size_t wcsftime(wchar_t *restrict wcs
, size_t n
, const wchar_t *restrict f
, const struct tm
*restrict tm
)
68 return __wcsftime_l(wcs
, n
, f
, tm
, CURRENT_LOCALE
);
71 weak_alias(__wcsftime_l
, wcsftime_l
);