7 const char *__strftime_fmt_1(char (*s)[100], size_t *l, int f, const struct tm *tm, locale_t loc);
9 size_t __wcsftime_l(wchar_t *restrict s, size_t n, const wchar_t *restrict f, const struct tm *restrict tm, locale_t loc)
19 for (l=0; l+1<n; 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;
33 if (width >= n-l) return 0;
38 if (*f == 'E' || *f == 'O') f++;
39 t_mb = __strftime_fmt_1(&buf, &k, *f, tm, loc);
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 if (width >= n-l) return 0;
54 for (; width > k; width--)
57 if (k >= n-l) return 0;
64 size_t wcsftime(wchar_t *restrict wcs, size_t n, const wchar_t *restrict f, const struct tm *restrict tm)
66 return __wcsftime_l(wcs, n, f, tm, 0);
69 weak_alias(__wcsftime_l, wcsftime_l);