Fix the issue of parsing 08:00AM, which currently gives a 20:00 representation.
ret = match_string (&buf, _ctloc (am_pm), locale);
if (ret < 0)
return NULL;
- if (timeptr->tm_hour == 0) {
- if (ret == 1)
- timeptr->tm_hour = 12;
- } else
- timeptr->tm_hour += 12;
+ if (timeptr->tm_hour > 12)
+ return NULL;
+ else if (timeptr->tm_hour == 12)
+ timeptr->tm_hour = ret * 12;
+ else
+ timeptr->tm_hour += ret * 12;
break;
case 'q' : /* quarter year - GNU extension */
ret = strtol_l (buf, &s, 10, locale);