]> Savannah Git Hosting - gnulib.git/commitdiff
parse-datetime no longer depends on nstrftime
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 16 Sep 2024 18:12:24 +0000 (11:12 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 16 Sep 2024 18:12:51 +0000 (11:12 -0700)
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.

ChangeLog
lib/parse-datetime.y
modules/parse-datetime

index d4f3555e6d89b88d425e9d65880e6c3aba9c6f6a..a619271ded938e7b952f963bfc63b49d28421a30 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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 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.
+
        Don’t port July [[...]] changes to C89
        Yesterday’s changes to port to C17 and earlier were intrusive,
        since they twice replaced one macro with two.  Revert the macro
index 665401d4227f90b84ba48c830c0d3cac177ca4ee..b036271d016f1c4b52d3a885010cd04a735f73be 100644 (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.  */
index e8ac3e725d00bf024cf6df0028a7c223b70c0c1c..fc26391aa9934455bff7c5c917018f906ebccc1f 100644 (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