4 #include "locale_impl.h"
8 size_t __wcsftime_l(wchar_t *restrict s
, size_t n
, const wchar_t *restrict f
, const struct tm
*restrict tm
, locale_t loc
)
29 if (*f
== '-' || *f
== '_' || *f
== '0') pad
= *f
++;
30 if ((plus
= (*f
== '+'))) f
++;
31 width
= wcstoul(f
, &p
, 10);
32 if (*p
== 'C' || *p
== 'F' || *p
== 'G' || *p
== 'Y') {
33 if (!width
&& p
!=f
) width
= 1;
38 if (*f
== 'E' || *f
== 'O') f
++;
39 t_mb
= __strftime_fmt_1(&buf
, &k
, *f
, tm
, loc
, pad
);
41 k
= mbstowcs(wbuf
, t_mb
, sizeof wbuf
/ sizeof *wbuf
);
42 if (k
== (size_t)-1) return 0;
45 for (; *t
=='+' || *t
=='-' || (*t
=='0'&&t
[1]); t
++, k
--);
47 if (plus
&& tm
->tm_year
>= 10000-1900)
49 else if (tm
->tm_year
< -1900)
53 for (; width
> k
&& l
< n
; width
--)
56 if (k
>= n
-l
) k
= n
-l
;
67 size_t wcsftime(wchar_t *restrict wcs
, size_t n
, const wchar_t *restrict f
, const struct tm
*restrict tm
)
69 return __wcsftime_l(wcs
, n
, f
, tm
, CURRENT_LOCALE
);
72 weak_alias(__wcsftime_l
, wcsftime_l
);