pw: reinitialize struct tm before every call to strptime
This prevents corrupted result due to leftover of previous failed call to strptime
This commit is contained in:
parent
30c85a085e
commit
0a9541d9f3
@ -128,8 +128,8 @@ parse_datesub(char const * str, struct tm *t)
|
||||
|
||||
l = newlocale(LC_ALL_MASK, "C", NULL);
|
||||
|
||||
memset(&tm, 0, sizeof(tm));
|
||||
for (i=0; valid_formats[i] != NULL; i++) {
|
||||
memset(&tm, 0, sizeof(tm));
|
||||
ret = strptime_l(str, valid_formats[i], &tm, l);
|
||||
if (ret && *ret == '\0') {
|
||||
t->tm_mday = tm.tm_mday;
|
||||
|
Loading…
Reference in New Issue
Block a user