1
0
mirror of https://git.savannah.gnu.org/git/gnulib.git synced 2025-08-08 17:22:05 +03:00

parse-datetime no longer depends on nstrftime

I discovered this unnecessary dependency when debugging
GNU Patch.
* lib/parse-datetime.y:
(populate_local_time_zone_table) [!HAVE_STRUCT_TM_TM_ZONE]:
(debug_strfdatetime): Use strftime not nstrftime,
as we don’t need nstrftime’s extensions or bug fixes.
* modules/parse-datetime (Depends-on): Remove nstrftime.
Also remove setenv, unsetenv, timegm, as this module
no longer depends on them directly.
This commit is contained in:
Paul Eggert
2024-09-16 11:12:24 -07:00
parent 3cbc5ea46f
commit 4f1f3d3cbe
3 changed files with 16 additions and 12 deletions

View File

@@ -1,5 +1,16 @@
2024-09-16 Paul Eggert <eggert@cs.ucla.edu>
parse-datetime no longer depends on nstrftime
I discovered this unnecessary dependency when debugging
GNU Patch.
* lib/parse-datetime.y:
(populate_local_time_zone_table) [!HAVE_STRUCT_TM_TM_ZONE]:
(debug_strfdatetime): Use strftime not nstrftime,
as we dont need nstrftimes extensions or bug fixes.
* modules/parse-datetime (Depends-on): Remove nstrftime.
Also remove setenv, unsetenv, timegm, as this module
no longer depends on them directly.
Dont port July [[...]] changes to C89
Yesterdays changes to port to C17 and earlier were intrusive,
since they twice replaced one macro with two. Revert the macro

View File

@@ -1591,7 +1591,7 @@ populate_local_time_zone_table (parser_control *pc, struct tm const *tm)
zone = tm->tm_zone;
#else
char *tz_abbr = pc->tz_abbr[first_entry_exists];
if (nstrftime (tz_abbr, TIME_ZONE_BUFSIZE, "%Z", tm, 0, 0))
if (strftime (tz_abbr, TIME_ZONE_BUFSIZE, "%Z", tm))
zone = tz_abbr;
#endif
e->name = zone;
@@ -1613,21 +1613,18 @@ debug_strfdatetime (struct tm const *tm, parser_control const *pc,
issues with the parsing - better to avoid formats that could
be mis-interpreted (e.g., just YYYY-MM-DD).
2. Can strftime be used instead?
depends if it is portable and can print invalid dates on all systems.
2. Print timezone information ?
3. Print timezone information ?
3. Print DST information ?
4. Print DST information ?
5. Print nanosecond information ?
4. Print nanosecond information ?
NOTE:
Printed date/time values might not be valid, e.g., '2016-02-31'
or '2016-19-2016' . These are the values as parsed from the user
string, before validation.
*/
int m = nstrftime (buf, n, "(Y-M-D) %Y-%m-%d %H:%M:%S", tm, 0, 0);
int m = strftime (buf, n, "(Y-M-D) %Y-%m-%d %H:%M:%S", tm);
/* If parser_control information was provided (for timezone),
and there's enough space in the buffer, add timezone info. */

View File

@@ -20,14 +20,10 @@ idx
intprops
inttypes
mktime
nstrftime
setenv
stdckdint
unsetenv
time-h
time_r
time_rz
timegm
configure.ac:
gl_PARSE_DATETIME