Explorar o código

fix processing of strptime %p format

string pointer was not advanced after matching.
Julien Ramseier %!s(int64=8) %!d(string=hai) anos
pai
achega
834ef7aff5
Modificáronse 1 ficheiros con 2 adicións e 0 borrados
  1. 2 0
      src/time/strptime.c

+ 2 - 0
src/time/strptime.c

@@ -94,6 +94,7 @@ char *strptime(const char *restrict s, const char *restrict f, struct tm *restri
 			len = strlen(ex);
 			if (!strncasecmp(s, ex, len)) {
 				tm->tm_hour %= 12;
+				s += len;
 				break;
 			}
 			ex = nl_langinfo(PM_STR);
@@ -101,6 +102,7 @@ char *strptime(const char *restrict s, const char *restrict f, struct tm *restri
 			if (!strncasecmp(s, ex, len)) {
 				tm->tm_hour %= 12;
 				tm->tm_hour += 12;
+				s += len;
 				break;
 			}
 			return 0;