diff options
Diffstat (limited to 'win32')
-rw-r--r-- | win32/strptime.c | 82 |
1 files changed, 8 insertions, 74 deletions
diff --git a/win32/strptime.c b/win32/strptime.c index 5dab9b4f4..c1164184d 100644 --- a/win32/strptime.c +++ b/win32/strptime.c | |||
@@ -454,85 +454,19 @@ __strptime_internal (const char *rp, const char *fmt, struct tm *tm, | |||
454 | case 'E': | 454 | case 'E': |
455 | /* We have no information about the era format. Just use | 455 | /* We have no information about the era format. Just use |
456 | the normal format. */ | 456 | the normal format. */ |
457 | if (*fmt != 'c' && *fmt != 'C' && *fmt != 'y' && *fmt != 'Y' | 457 | if (strchr("cCyYxX", *fmt) == NULL) |
458 | && *fmt != 'x' && *fmt != 'X') | ||
459 | /* This is an illegal format. */ | 458 | /* This is an illegal format. */ |
460 | return NULL; | 459 | return NULL; |
461 | 460 | ||
462 | goto start_over; | 461 | goto start_over; |
463 | case 'O': | 462 | case 'O': |
464 | switch (*fmt++) | 463 | /* We don't have an alternative number format. Just use |
465 | { | 464 | the normal format. */ |
466 | case 'd': | 465 | if (strchr("deHImMSUWVwy", *fmt) == NULL) |
467 | case 'e': | 466 | /* This is an illegal format. */ |
468 | /* Match day of month using alternate numeric symbols. */ | 467 | return NULL; |
469 | get_alt_number (1, 31, 2); | 468 | |
470 | tm->tm_mday = val; | 469 | goto start_over; |
471 | have_mday = 1; | ||
472 | want_xday = 1; | ||
473 | break; | ||
474 | case 'H': | ||
475 | /* Match hour in 24-hour clock using alternate numeric | ||
476 | symbols. */ | ||
477 | get_alt_number (0, 23, 2); | ||
478 | tm->tm_hour = val; | ||
479 | have_I = 0; | ||
480 | break; | ||
481 | case 'I': | ||
482 | /* Match hour in 12-hour clock using alternate numeric | ||
483 | symbols. */ | ||
484 | get_alt_number (1, 12, 2); | ||
485 | tm->tm_hour = val % 12; | ||
486 | have_I = 1; | ||
487 | break; | ||
488 | case 'm': | ||
489 | /* Match month using alternate numeric symbols. */ | ||
490 | get_alt_number (1, 12, 2); | ||
491 | tm->tm_mon = val - 1; | ||
492 | have_mon = 1; | ||
493 | want_xday = 1; | ||
494 | break; | ||
495 | case 'M': | ||
496 | /* Match minutes using alternate numeric symbols. */ | ||
497 | get_alt_number (0, 59, 2); | ||
498 | tm->tm_min = val; | ||
499 | break; | ||
500 | case 'S': | ||
501 | /* Match seconds using alternate numeric symbols. */ | ||
502 | get_alt_number (0, 61, 2); | ||
503 | tm->tm_sec = val; | ||
504 | break; | ||
505 | case 'U': | ||
506 | get_alt_number (0, 53, 2); | ||
507 | week_no = val; | ||
508 | have_uweek = 1; | ||
509 | break; | ||
510 | case 'W': | ||
511 | get_alt_number (0, 53, 2); | ||
512 | week_no = val; | ||
513 | have_wweek = 1; | ||
514 | break; | ||
515 | case 'V': | ||
516 | get_alt_number (0, 53, 2); | ||
517 | /* XXX This cannot determine any field in TM without | ||
518 | further information. */ | ||
519 | break; | ||
520 | case 'w': | ||
521 | /* Match number of weekday using alternate numeric symbols. */ | ||
522 | get_alt_number (0, 6, 1); | ||
523 | tm->tm_wday = val; | ||
524 | have_wday = 1; | ||
525 | break; | ||
526 | case 'y': | ||
527 | /* Match year within century using alternate numeric symbols. */ | ||
528 | get_alt_number (0, 99, 2); | ||
529 | tm->tm_year = val >= 69 ? val : val + 100; | ||
530 | want_xday = 1; | ||
531 | break; | ||
532 | default: | ||
533 | return NULL; | ||
534 | } | ||
535 | break; | ||
536 | default: | 470 | default: |
537 | return NULL; | 471 | return NULL; |
538 | } | 472 | } |