diff options
-rw-r--r-- | missing_d/ChangeLog | 6 | ||||
-rw-r--r-- | missing_d/strptime.c | 5 |
2 files changed, 10 insertions, 1 deletions
diff --git a/missing_d/ChangeLog b/missing_d/ChangeLog index b01a6535..9607a336 100644 --- a/missing_d/ChangeLog +++ b/missing_d/ChangeLog @@ -1,3 +1,9 @@ +2023-04-15 Arnold D. Robbins <arnold@skeeve.com> + + * strptime.c (strptime_internal): Rework a bit to use localtime() + instead of localtime_r(). This lets it work for MinGW and maybe + other systems. Thanks to Eli Zaretskii <eliz@gnu.org> for the report. + 2023-03-12 Arnold D. Robbins <arnold@skeeve.com> * strptime.c: New file, from GNULIB, with a few slight mods. diff --git a/missing_d/strptime.c b/missing_d/strptime.c index 670c5320..5e87f618 100644 --- a/missing_d/strptime.c +++ b/missing_d/strptime.c @@ -571,6 +571,7 @@ __strptime_internal (rp, fmt, tm, decided, era_cnt LOCALE_PARAM) character for character and construct the result while doing this. */ time_t secs = 0; + struct tm *then; if (*rp < '0' || *rp > '9') /* We need at least one digit. */ return NULL; @@ -582,9 +583,11 @@ __strptime_internal (rp, fmt, tm, decided, era_cnt LOCALE_PARAM) } while (*rp >= '0' && *rp <= '9'); - if (localtime_r (&secs, tm) == NULL) + if ((then = localtime (&secs)) == NULL) /* Error in function. */ return NULL; + else + *tm = *then; } break; case 'S': |