int i, w, neg, adj, min, range, *dest, dummy;
const char *ex;
size_t len;
- int want_century = 0, century = 0;
+ int want_century = 0, century = 0, relyear = 0;
while (*f) {
if (*f != '%') {
if (isspace(*f)) for (; *s && isspace(*s); s++);
dest = &tm->tm_yday;
min = 1;
range = 366;
+ adj = 1;
goto numeric_range;
case 'm':
dest = &tm->tm_mon;
len = strlen(ex);
if (!strncasecmp(s, ex, len)) {
tm->tm_hour %= 12;
+ s += len;
break;
}
ex = nl_langinfo(PM_STR);
if (!strncasecmp(s, ex, len)) {
tm->tm_hour %= 12;
tm->tm_hour += 12;
+ s += len;
break;
}
return 0;
if (!s) return 0;
break;
case 'y':
- dest = &tm->tm_year;
+ dest = &relyear;
w = 2;
want_century |= 1;
goto numeric_digits;
}
}
if (want_century) {
+ tm->tm_year = relyear;
if (want_century & 2) tm->tm_year += century * 100 - 1900;
else if (tm->tm_year <= 68) tm->tm_year += 100;
}