Lines Matching +full:un +full:- +full:padded

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
48 #include "un-namespace.h"
72 5 * ((year - 1) % 4) +
73 4 * ((year - 1) % 100) +
74 6 * ((year - 1) % 400)) % 7);
83 int day_offset = -1, wday_offset;
96 century = -1;
97 year = -1;
124 buf = _strptime(buf, tptr->date_fmt, tm, GMTp, locale);
134 /* XXX This will break for 3-digit centuries. */
139 i += *buf - '0';
140 len--;
149 buf = _strptime(buf, tptr->c_fmt, tm, GMTp, locale);
175 buf = _strptime(buf, "%Y-%m-%d", tm, GMTp, locale);
188 buf = _strptime(buf, tptr->ampm_fmt, tm, GMTp, locale);
200 buf = _strptime(buf, tptr->X_fmt, tm, GMTp, locale);
206 buf = _strptime(buf, tptr->x_fmt, tm, GMTp, locale);
220 i += *buf - '0';
221 len--;
226 tm->tm_yday = i - 1;
244 i += *buf - '0';
245 len--;
251 tm->tm_min = i;
255 tm->tm_sec = i;
266 * blank-padded. However, there is no harm in
267 * allowing zero-padding.
286 i += *buf - '0';
287 len--;
295 tm->tm_hour = i;
301 * XXX This is bogus if parsed before hour-related
304 if (tm->tm_hour > 12)
307 len = strlen(tptr->am);
308 if (strncasecmp_l(buf, tptr->am, len, locale) == 0) {
309 if (tm->tm_hour == 12)
310 tm->tm_hour = 0;
315 len = strlen(tptr->pm);
316 if (strncasecmp_l(buf, tptr->pm, len, locale) == 0) {
317 if (tm->tm_hour != 12)
318 tm->tm_hour += 12;
327 for (i = 0; i < asizeof(tptr->weekday); i++) {
328 len = strlen(tptr->weekday[i]);
329 if (strncasecmp_l(buf, tptr->weekday[i],
332 len = strlen(tptr->wday[i]);
333 if (strncasecmp_l(buf, tptr->wday[i],
337 if (i == asizeof(tptr->weekday))
341 tm->tm_wday = i;
360 i += *buf - '0';
361 len--;
381 i = *buf++ - '0';
386 tm->tm_wday = i % 7;
403 * not being zero-padded but was later changed to
417 i += *buf - '0';
418 len--;
423 tm->tm_mday = i;
431 for (i = 0; i < asizeof(tptr->month); i++) {
434 len = strlen(tptr->alt_month[i]);
436 tptr->alt_month[i],
441 len = strlen(tptr->month[i]);
442 if (strncasecmp_l(buf, tptr->month[i],
451 if (i == asizeof(tptr->month) && !Oalternative) {
452 for (i = 0; i < asizeof(tptr->month); i++) {
453 len = strlen(tptr->mon[i]);
454 if (strncasecmp_l(buf, tptr->mon[i],
459 if (i == asizeof(tptr->month))
462 tm->tm_mon = i;
476 i += *buf - '0';
477 len--;
482 tm->tm_mon = i - 1;
524 i += *buf - '0';
525 len--;
543 if (cp - buf) {
544 zonestr = alloca(cp - buf + 1);
545 strncpy(zonestr, buf, cp - buf);
546 zonestr[cp - buf] = '\0';
552 tm->tm_isdst = 0;
554 tm->tm_isdst = 1;
558 buf += cp - buf;
568 if (*buf == '-')
569 sign = -1;
576 for (len = 4; len > 0; len--) {
579 i += *buf - '0';
588 if (i > 1400 || (sign == -1 && i > 1200) ||
591 tm->tm_hour -= sign * (i / 100);
592 tm->tm_min -= sign * (i % 100);
608 if (century != -1 || year != -1) {
609 if (year == -1)
611 if (century == -1) {
615 year += century * 100 - TM_YEAR_BASE;
616 tm->tm_year = year;
622 tm->tm_yday = start_of_month[isleap(tm->tm_year +
623 TM_YEAR_BASE)][tm->tm_mon] + (tm->tm_mday - 1);
625 } else if (day_offset != -1) {
628 fwo = first_wday_of(tm->tm_year + TM_YEAR_BASE);
636 tmpwday = (flags & FLAG_WDAY) ? tm->tm_wday :
638 tmpyday = (7 - fwo + day_offset) % 7 +
639 (week_offset - 1) * 7 +
640 (tmpwday - day_offset + 7) % 7;
647 tm->tm_yday = tmpyday;
655 while (tm->tm_yday >=
656 start_of_month[isleap(tm->tm_year +
661 tm->tm_yday -=
662 start_of_month[isleap(tm->tm_year +
664 tm->tm_year++;
666 tm->tm_mon = i - 1;
670 tm->tm_mday = tm->tm_yday -
671 start_of_month[isleap(tm->tm_year + TM_YEAR_BASE)]
672 [tm->tm_mon] + 1;
676 wday_offset = first_wday_of(tm->tm_year + TM_YEAR_BASE);
677 tm->tm_wday = (wday_offset + tm->tm_yday) % 7;