/* If 1 Jan is just 1-3 days past Monday,
* the previous week is also in this year. */
/* If 1 Jan is just 1-3 days past Monday,
* the previous week is also in this year. */
val++;
if (!val) {
val = 52;
/* If 31 December of prev year a Thursday,
* or Friday of a leap year, then the
* prev year has 53 weeks. */
val++;
if (!val) {
val = 52;
/* If 31 December of prev year a Thursday,
* or Friday of a leap year, then the
* prev year has 53 weeks. */
if (dec31 == 4 || (dec31 == 5 && is_leap(tm->tm_year%400-1)))
val++;
} else if (val == 53) {
/* If 1 January is not a Thursday, and not
* a Wednesday of a leap year, then this
* year has only 52 weeks. */
if (dec31 == 4 || (dec31 == 5 && is_leap(tm->tm_year%400-1)))
val++;
} else if (val == 53) {
/* If 1 January is not a Thursday, and not
* a Wednesday of a leap year, then this
* year has only 52 weeks. */
if (val >= 10000) {
*l = snprintf(*s, sizeof *s, "+%lld", val);
return *s;
if (val >= 10000) {
*l = snprintf(*s, sizeof *s, "+%lld", val);
return *s;
return "";
}
*l = snprintf(*s, sizeof *s, "%+.2d%.2d",
return "";
}
*l = snprintf(*s, sizeof *s, "%+.2d%.2d",
size_t strftime(char *restrict s, size_t n, const char *restrict f, const struct tm *restrict tm)
{
size_t strftime(char *restrict s, size_t n, const char *restrict f, const struct tm *restrict tm)
{
- return __strftime_l(s, n, f, tm, 0);
+ return __strftime_l(s, n, f, tm, CURRENT_LOCALE);