> > If adopting GNULIB_POSIXCHECK for time-h would regularize 
> > things please feel free to do that.
> 
> Indeed, regularizing things would be useful:

Done through these two patches.


2023-07-29  Bruno Haible  <br...@clisp.org>

        time-h: Simplify after 2017-05-01 change.
        * m4/time_h.m4 (gl_TIME_H_DEFAULTS): Don't provide a default value for
        GNULIB_GETTIMEOFDAY.

        time-h: Obey GNULIB_POSIXCHECK, not GNULIB_PORTCHECK.
        * lib/time.in.h (timespec_get, timespec_getres, time, nanosleep, tzset,
        mktime, localtime_r, gmtime_r, localtime, strptime, ctime, strftime,
        timegm): Add _GL_WARN_ON_USE invocation.
        (asctime, ctime): Don't assume that these functions are declared, since
        POSIX obsoletes them.
        * m4/time_h.m4 (gl_TIME_H): Test for the declarations of asctime, ctime,
        gmtime_r, localtime, localtime_r, mktime, nanosleep, strftime, strptime,
        time, timegm, timespec_get, timespec_getres, tzset.
        (gl_TIME_H_DEFAULTS): Initialize REPLACE_CTIME, REPLACE_LOCALTIME_R,
        REPLACE_MKTIME, REPLACE_NANOSLEEP, REPLACE_STRFTIME, REPLACE_TIMEGM,
        REPLACE_TIMESPEC_GET, REPLACE_TZSET with 0 instead of GNULIB_PORTCHECK.
        * m4/ctime.m4 (gl_FUNC_CTIME): Don't re-initialize REPLACE_CTIME.
        * m4/time_r.m4 (gl_TIME_R): Don't re-initialize REPLACE_LOCALTIME_R.
        * m4/mktime.m4 (gl_FUNC_MKTIME): Don't re-initialize REPLACE_MKTIME.
        * m4/nanosleep.m4 (gl_FUNC_NANOSLEEP): Don't re-initialize
        REPLACE_NANOSLEEP.
        * m4/strftime-fixes.m4 (gl_FUNC_STRFTIME): Don't re-initialize
        REPLACE_STRFTIME.
        * m4/timegm.m4 (gl_FUNC_TIMEGM): Don't re-initialize REPLACE_TIMEGM.
        * m4/timespec_get.m4 (gl_FUNC_TIMESPEC_GET): Don't re-initialize
        REPLACE_TIMESPEC_GET.
        * m4/tzset.m4 (gl_FUNC_TZSET: Don't re-initialize REPLACE_TZSET.

From b90baa07983cc3e4eb53933de631296a5fc8c248 Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Sat, 29 Jul 2023 18:07:45 +0200
Subject: [PATCH 1/2] time-h: Obey GNULIB_POSIXCHECK, not GNULIB_PORTCHECK.

* lib/time.in.h (timespec_get, timespec_getres, time, nanosleep, tzset,
mktime, localtime_r, gmtime_r, localtime, strptime, ctime, strftime,
timegm): Add _GL_WARN_ON_USE invocation.
(asctime, ctime): Don't assume that these functions are declared, since
POSIX obsoletes them.
* m4/time_h.m4 (gl_TIME_H): Test for the declarations of asctime, ctime,
gmtime_r, localtime, localtime_r, mktime, nanosleep, strftime, strptime,
time, timegm, timespec_get, timespec_getres, tzset.
(gl_TIME_H_DEFAULTS): Initialize REPLACE_CTIME, REPLACE_LOCALTIME_R,
REPLACE_MKTIME, REPLACE_NANOSLEEP, REPLACE_STRFTIME, REPLACE_TIMEGM,
REPLACE_TIMESPEC_GET, REPLACE_TZSET with 0 instead of GNULIB_PORTCHECK.
* m4/ctime.m4 (gl_FUNC_CTIME): Don't re-initialize REPLACE_CTIME.
* m4/time_r.m4 (gl_TIME_R): Don't re-initialize REPLACE_LOCALTIME_R.
* m4/mktime.m4 (gl_FUNC_MKTIME): Don't re-initialize REPLACE_MKTIME.
* m4/nanosleep.m4 (gl_FUNC_NANOSLEEP): Don't re-initialize
REPLACE_NANOSLEEP.
* m4/strftime-fixes.m4 (gl_FUNC_STRFTIME): Don't re-initialize
REPLACE_STRFTIME.
* m4/timegm.m4 (gl_FUNC_TIMEGM): Don't re-initialize REPLACE_TIMEGM.
* m4/timespec_get.m4 (gl_FUNC_TIMESPEC_GET): Don't re-initialize
REPLACE_TIMESPEC_GET.
* m4/tzset.m4 (gl_FUNC_TZSET: Don't re-initialize REPLACE_TZSET.
---
 ChangeLog            | 26 ++++++++++++++
 lib/time.in.h        | 81 ++++++++++++++++++++++++++++++++++++++++++++
 m4/ctime.m4          |  3 +-
 m4/mktime.m4         |  3 +-
 m4/nanosleep.m4      |  6 ++--
 m4/strftime-fixes.m4 |  3 +-
 m4/time_h.m4         | 35 +++++++++----------
 m4/time_r.m4         |  4 +--
 m4/timegm.m4         |  3 +-
 m4/timespec_get.m4   |  3 +-
 m4/tzset.m4          |  3 +-
 11 files changed, 132 insertions(+), 38 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 02e7fca1df..fd83cb6770 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,29 @@
+2023-07-29  Bruno Haible  <br...@clisp.org>
+
+	time-h: Obey GNULIB_POSIXCHECK, not GNULIB_PORTCHECK.
+	* lib/time.in.h (timespec_get, timespec_getres, time, nanosleep, tzset,
+	mktime, localtime_r, gmtime_r, localtime, strptime, ctime, strftime,
+	timegm): Add _GL_WARN_ON_USE invocation.
+	(asctime, ctime): Don't assume that these functions are declared, since
+	POSIX obsoletes them.
+	* m4/time_h.m4 (gl_TIME_H): Test for the declarations of asctime, ctime,
+	gmtime_r, localtime, localtime_r, mktime, nanosleep, strftime, strptime,
+	time, timegm, timespec_get, timespec_getres, tzset.
+	(gl_TIME_H_DEFAULTS): Initialize REPLACE_CTIME, REPLACE_LOCALTIME_R,
+	REPLACE_MKTIME, REPLACE_NANOSLEEP, REPLACE_STRFTIME, REPLACE_TIMEGM,
+	REPLACE_TIMESPEC_GET, REPLACE_TZSET with 0 instead of GNULIB_PORTCHECK.
+	* m4/ctime.m4 (gl_FUNC_CTIME): Don't re-initialize REPLACE_CTIME.
+	* m4/time_r.m4 (gl_TIME_R): Don't re-initialize REPLACE_LOCALTIME_R.
+	* m4/mktime.m4 (gl_FUNC_MKTIME): Don't re-initialize REPLACE_MKTIME.
+	* m4/nanosleep.m4 (gl_FUNC_NANOSLEEP): Don't re-initialize
+	REPLACE_NANOSLEEP.
+	* m4/strftime-fixes.m4 (gl_FUNC_STRFTIME): Don't re-initialize
+	REPLACE_STRFTIME.
+	* m4/timegm.m4 (gl_FUNC_TIMEGM): Don't re-initialize REPLACE_TIMEGM.
+	* m4/timespec_get.m4 (gl_FUNC_TIMESPEC_GET): Don't re-initialize
+	REPLACE_TIMESPEC_GET.
+	* m4/tzset.m4 (gl_FUNC_TZSET: Don't re-initialize REPLACE_TZSET.
+
 2023-07-28  Bruno Haible  <br...@clisp.org>
 
 	fnmatch: Ensure that on Cygwin ≥ 3.5.0, Cygwin's native fnmatch is used.
diff --git a/lib/time.in.h b/lib/time.in.h
index 06428adb1d..06824da9d3 100644
--- a/lib/time.in.h
+++ b/lib/time.in.h
@@ -143,6 +143,12 @@ _GL_CXXALIAS_SYS (timespec_get, int, (struct timespec *ts, int base));
 #  if __GLIBC__ >= 2
 _GL_CXXALIASWARN (timespec_get);
 #  endif
+# elif defined GNULIB_POSIXCHECK
+#  undef timespec_get
+#  if HAVE_RAW_DECL_TIMESPEC_GET
+_GL_WARN_ON_USE (timespec_get, "timespec_get is unportable - "
+                 "use gnulib module timespec_get for portability");
+#  endif
 # endif
 
 /* Set *TS to the current time resolution, and return BASE.
@@ -154,6 +160,12 @@ _GL_FUNCDECL_SYS (timespec_getres, int, (struct timespec *ts, int base)
 #  endif
 _GL_CXXALIAS_SYS (timespec_getres, int, (struct timespec *ts, int base));
 _GL_CXXALIASWARN (timespec_getres);
+# elif defined GNULIB_POSIXCHECK
+#  undef timespec_getres
+#  if HAVE_RAW_DECL_TIMESPEC_GETRES
+_GL_WARN_ON_USE (timespec_getres, "timespec_getres is unportable - "
+                 "use gnulib module timespec_getres for portability");
+#  endif
 # endif
 
 /* Return the number of seconds that have elapsed since the Epoch.  */
@@ -170,6 +182,12 @@ _GL_CXXALIAS_SYS (time, time_t, (time_t *__tp));
 #  if __GLIBC__ >= 2
 _GL_CXXALIASWARN (time);
 #  endif
+# elif defined GNULIB_POSIXCHECK
+#  undef time
+#  if HAVE_RAW_DECL_TIME
+_GL_WARN_ON_USE (time, "time has consistency problems - "
+                 "use gnulib module time for portability");
+#  endif
 # endif
 
 /* Sleep for at least RQTP seconds unless interrupted,  If interrupted,
@@ -195,6 +213,12 @@ _GL_CXXALIAS_SYS (nanosleep, int,
                   (struct timespec const *__rqtp, struct timespec *__rmtp));
 #  endif
 _GL_CXXALIASWARN (nanosleep);
+# elif defined GNULIB_POSIXCHECK
+#  undef nanosleep
+#  if HAVE_RAW_DECL_NANOSLEEP
+_GL_WARN_ON_USE (nanosleep, "nanosleep is unportable - "
+                 "use gnulib module nanosleep for portability");
+#  endif
 # endif
 
 /* Initialize time conversion information.  */
@@ -230,6 +254,12 @@ _GL_CXXALIAS_MDA (tzset, void, (void));
 _GL_CXXALIAS_SYS (tzset, void, (void));
 #  endif
 _GL_CXXALIASWARN (tzset);
+# elif defined GNULIB_POSIXCHECK
+#  undef tzset
+#  if HAVE_RAW_DECL_TZSET
+_GL_WARN_ON_USE (tzset, "tzset has portability problems - "
+                 "use gnulib module tzset for portability");
+#  endif
 # endif
 
 /* Return the 'time_t' representation of TP and normalize TP.  */
@@ -246,6 +276,12 @@ _GL_CXXALIAS_SYS (mktime, time_t, (struct tm *__tp));
 #  if __GLIBC__ >= 2
 _GL_CXXALIASWARN (mktime);
 #  endif
+# elif defined GNULIB_POSIXCHECK
+#  undef mktime
+#  if HAVE_RAW_DECL_MKTIME
+_GL_WARN_ON_USE (mktime, "mktime has portability problems - "
+                 "use gnulib module mktime for portability");
+#  endif
 # endif
 
 /* Convert TIMER to RESULT, assuming local time and UTC respectively.  See
@@ -296,6 +332,17 @@ _GL_CXXALIAS_SYS (gmtime_r, struct tm *, (time_t const *restrict __timer,
 #  if @HAVE_DECL_LOCALTIME_R@
 _GL_CXXALIASWARN (gmtime_r);
 #  endif
+# elif defined GNULIB_POSIXCHECK
+#  undef localtime_r
+#  if HAVE_RAW_DECL_LOCALTIME_R
+_GL_WARN_ON_USE (localtime_r, "localtime_r is unportable - "
+                 "use gnulib module time_r for portability");
+#  endif
+#  undef gmtime_r
+#  if HAVE_RAW_DECL_GMTIME_R
+_GL_WARN_ON_USE (gmtime_r, "gmtime_r is unportable - "
+                 "use gnulib module time_r for portability");
+#  endif
 # endif
 
 /* Convert TIMER to RESULT, assuming local time and UTC respectively.  See
@@ -316,6 +363,12 @@ _GL_CXXALIAS_SYS (localtime, struct tm *, (time_t const *__timer));
 #  if __GLIBC__ >= 2
 _GL_CXXALIASWARN (localtime);
 #  endif
+# elif defined GNULIB_POSIXCHECK
+#  undef localtime
+#  if HAVE_RAW_DECL_LOCALTIME
+_GL_WARN_ON_USE (localtime, "localtime has portability problems - "
+                 "use gnulib module localtime for portability");
+#  endif
 # endif
 
 # if 0 || @REPLACE_GMTIME@
@@ -347,6 +400,12 @@ _GL_CXXALIAS_SYS (strptime, char *, (char const *restrict __buf,
                                      char const *restrict __format,
                                      struct tm *restrict __tm));
 _GL_CXXALIASWARN (strptime);
+# elif defined GNULIB_POSIXCHECK
+#  undef strptime
+#  if HAVE_RAW_DECL_STRPTIME
+_GL_WARN_ON_USE (strptime, "strptime is unportable - "
+                 "use gnulib module strptime for portability");
+#  endif
 # endif
 
 /* Convert *TP to a date and time string.  See
@@ -368,6 +427,12 @@ _GL_CXXALIAS_SYS (ctime, char *, (time_t const *__tp));
 #  if __GLIBC__ >= 2
 _GL_CXXALIASWARN (ctime);
 #  endif
+# elif defined GNULIB_POSIXCHECK
+#  undef ctime
+#  if HAVE_RAW_DECL_CTIME
+_GL_WARN_ON_USE (ctime, "ctime has portability problems - "
+                 "use gnulib module ctime for portability");
+#  endif
 # endif
 
 /* Convert *TP to a date and time string.  See
@@ -392,6 +457,12 @@ _GL_CXXALIAS_SYS (strftime, size_t,
 #  if __GLIBC__ >= 2
 _GL_CXXALIASWARN (strftime);
 #  endif
+# elif defined GNULIB_POSIXCHECK
+#  undef strftime
+#  if HAVE_RAW_DECL_STRFTIME
+_GL_WARN_ON_USE (strftime, "strftime has portability problems - "
+                 "use gnulib module strftime-fixes for portability");
+#  endif
 # endif
 
 # if defined _GNU_SOURCE && @GNULIB_TIME_RZ@ && ! @HAVE_TIMEZONE_T@
@@ -469,6 +540,12 @@ _GL_CXXALIAS_SYS (timegm, time_t, (struct tm *__tm));
 #  if __GLIBC__ >= 2
 _GL_CXXALIASWARN (timegm);
 #  endif
+# elif defined GNULIB_POSIXCHECK
+#  undef timegm
+#  if HAVE_RAW_DECL_TIMEGM
+_GL_WARN_ON_USE (timegm, "timegm is unportable - "
+                 "use gnulib module timegm for portability");
+#  endif
 # endif
 
 /* Encourage applications to avoid unsafe functions that can overrun
@@ -476,8 +553,10 @@ _GL_CXXALIASWARN (timegm);
    applications should use strftime (or even sprintf) instead.  */
 # if defined GNULIB_POSIXCHECK
 #  undef asctime
+#  if HAVE_RAW_DECL_ASCTIME
 _GL_WARN_ON_USE (asctime, "asctime can overrun buffers in some cases - "
                  "better use strftime (or even sprintf) instead");
+#  endif
 # endif
 # if defined GNULIB_POSIXCHECK
 #  undef asctime_r
@@ -488,8 +567,10 @@ _GL_WARN_ON_USE (asctime_r, "asctime_r can overrun buffers in some cases - "
 # endif
 # if defined GNULIB_POSIXCHECK
 #  undef ctime
+#  if HAVE_RAW_DECL_CTIME
 _GL_WARN_ON_USE (ctime, "ctime can overrun buffers in some cases - "
                  "better use strftime (or even sprintf) instead");
+#  endif
 # endif
 # if defined GNULIB_POSIXCHECK
 #  undef ctime_r
diff --git a/m4/ctime.m4 b/m4/ctime.m4
index 08aeb67454..4fe21b0c95 100644
--- a/m4/ctime.m4
+++ b/m4/ctime.m4
@@ -1,4 +1,4 @@
-# ctime.m4 serial 2
+# ctime.m4 serial 3
 dnl Copyright (C) 2017-2023 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -10,6 +10,5 @@ AC_DEFUN([gl_FUNC_CTIME]
   AC_REQUIRE([AC_CANONICAL_HOST])
   case "$host_os" in
     mingw*) REPLACE_CTIME=1 ;;
-    *)      REPLACE_CTIME=0 ;;
   esac
 ])
diff --git a/m4/mktime.m4 b/m4/mktime.m4
index e9d31f35a4..69cce86da5 100644
--- a/m4/mktime.m4
+++ b/m4/mktime.m4
@@ -1,4 +1,4 @@
-# serial 37
+# serial 38
 dnl Copyright (C) 2002-2003, 2005-2007, 2009-2023 Free Software Foundation,
 dnl Inc.
 dnl This file is free software; the Free Software Foundation
@@ -280,7 +280,6 @@ AC_DEFUN([gl_FUNC_MKTIME]
   AC_REQUIRE([AC_CANONICAL_HOST])
   AC_REQUIRE([gl_FUNC_MKTIME_WORKS])
 
-  REPLACE_MKTIME=0
   if test "$gl_cv_func_working_mktime" != yes; then
     REPLACE_MKTIME=1
     AC_DEFINE([NEED_MKTIME_WORKING], [1],
diff --git a/m4/nanosleep.m4 b/m4/nanosleep.m4
index e21a3e343c..b7f22d7b60 100644
--- a/m4/nanosleep.m4
+++ b/m4/nanosleep.m4
@@ -1,4 +1,4 @@
-# serial 43
+# serial 44
 
 dnl From Jim Meyering.
 dnl Check for the nanosleep function.
@@ -126,9 +126,7 @@ AC_DEFUN([gl_FUNC_NANOSLEEP]
        ])
     ])
    case "$gl_cv_func_nanosleep" in
-     *yes)
-       REPLACE_NANOSLEEP=0
-       ;;
+     *yes) ;;
      *)
        REPLACE_NANOSLEEP=1
        case "$gl_cv_func_nanosleep" in
diff --git a/m4/strftime-fixes.m4 b/m4/strftime-fixes.m4
index ee587aa223..19136d03b9 100644
--- a/m4/strftime-fixes.m4
+++ b/m4/strftime-fixes.m4
@@ -1,4 +1,4 @@
-# strftime-fixes.m4 serial 2
+# strftime-fixes.m4 serial 3
 dnl Copyright (C) 2017-2023 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -10,6 +10,5 @@ AC_DEFUN([gl_FUNC_STRFTIME]
   AC_REQUIRE([AC_CANONICAL_HOST])
   case "$host_os" in
     mingw*) REPLACE_STRFTIME=1 ;;
-    *)      REPLACE_STRFTIME=0 ;;
   esac
 ])
diff --git a/m4/time_h.m4 b/m4/time_h.m4
index 51d553a2f1..8cc9ac8792 100644
--- a/m4/time_h.m4
+++ b/m4/time_h.m4
@@ -2,7 +2,7 @@
 
 # Copyright (C) 2000-2001, 2003-2007, 2009-2023 Free Software Foundation, Inc.
 
-# serial 22
+# serial 23
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -23,7 +23,10 @@ AC_DEFUN_ONCE([gl_TIME_H]
   dnl corresponding gnulib module is not in use.
   gl_WARN_ON_USE_PREPARE([[
 #include <time.h>
-    ]], [asctime_r ctime_r])
+    ]], [
+      asctime asctime_r ctime ctime_r gmtime_r localtime localtime_r mktime
+      nanosleep strftime strptime time timegm timespec_get timespec_getres tzset
+    ])
 
   AC_REQUIRE([AC_C_RESTRICT])
 
@@ -162,25 +165,19 @@ AC_DEFUN([gl_TIME_H_DEFAULTS]
   HAVE_TIMESPEC_GETRES=1;                AC_SUBST([HAVE_TIMESPEC_GETRES])
   dnl Even GNU libc does not have timezone_t yet.
   HAVE_TIMEZONE_T=0;                     AC_SUBST([HAVE_TIMEZONE_T])
-  dnl If another module says to replace or to not replace, do that.
-  dnl Otherwise, replace only if someone compiles with -DGNULIB_PORTCHECK;
-  dnl this lets maintainers check for portability.
-  REPLACE_CTIME=GNULIB_PORTCHECK;        AC_SUBST([REPLACE_CTIME])
-  REPLACE_LOCALTIME_R=GNULIB_PORTCHECK;  AC_SUBST([REPLACE_LOCALTIME_R])
-  REPLACE_MKTIME=GNULIB_PORTCHECK;       AC_SUBST([REPLACE_MKTIME])
-  REPLACE_NANOSLEEP=GNULIB_PORTCHECK;    AC_SUBST([REPLACE_NANOSLEEP])
-  REPLACE_STRFTIME=GNULIB_PORTCHECK;     AC_SUBST([REPLACE_STRFTIME])
+  REPLACE_CTIME=0;                       AC_SUBST([REPLACE_CTIME])
+  REPLACE_GMTIME=0;                      AC_SUBST([REPLACE_GMTIME])
+  REPLACE_LOCALTIME=0;                   AC_SUBST([REPLACE_LOCALTIME])
+  REPLACE_LOCALTIME_R=0;                 AC_SUBST([REPLACE_LOCALTIME_R])
+  REPLACE_MKTIME=0;                      AC_SUBST([REPLACE_MKTIME])
+  REPLACE_NANOSLEEP=0;                   AC_SUBST([REPLACE_NANOSLEEP])
+  REPLACE_STRFTIME=0;                    AC_SUBST([REPLACE_STRFTIME])
   REPLACE_TIME=0;                        AC_SUBST([REPLACE_TIME])
-  REPLACE_TIMEGM=GNULIB_PORTCHECK;       AC_SUBST([REPLACE_TIMEGM])
-  REPLACE_TIMESPEC_GET=GNULIB_PORTCHECK; AC_SUBST([REPLACE_TIMESPEC_GET])
-  REPLACE_TZSET=GNULIB_PORTCHECK;        AC_SUBST([REPLACE_TZSET])
+  REPLACE_TIMEGM=0;                      AC_SUBST([REPLACE_TIMEGM])
+  REPLACE_TIMESPEC_GET=0;                AC_SUBST([REPLACE_TIMESPEC_GET])
+  REPLACE_TZSET=0;                       AC_SUBST([REPLACE_TZSET])
 
   dnl Hack so that the time module doesn't depend on the sys_time module.
-  dnl First, default GNULIB_GETTIMEOFDAY to 0 if sys_time is absent.
+  dnl Default GNULIB_GETTIMEOFDAY to 0 if sys_time is absent.
   : ${GNULIB_GETTIMEOFDAY=0};            AC_SUBST([GNULIB_GETTIMEOFDAY])
-  dnl Second, it's OK to not use GNULIB_PORTCHECK for REPLACE_GMTIME
-  dnl and REPLACE_LOCALTIME, as portability to Solaris 2.6 and earlier
-  dnl is no longer a big deal.
-  REPLACE_GMTIME=0;                      AC_SUBST([REPLACE_GMTIME])
-  REPLACE_LOCALTIME=0;                   AC_SUBST([REPLACE_LOCALTIME])
 ])
diff --git a/m4/time_r.m4 b/m4/time_r.m4
index adce438abf..4831eb26f9 100644
--- a/m4/time_r.m4
+++ b/m4/time_r.m4
@@ -57,9 +57,7 @@ AC_DEFUN([gl_TIME_R]
          [gl_cv_time_r_posix=yes],
          [gl_cv_time_r_posix=no])
       ])
-    if test $gl_cv_time_r_posix = yes; then
-      REPLACE_LOCALTIME_R=0
-    else
+    if test $gl_cv_time_r_posix != yes; then
       REPLACE_LOCALTIME_R=1
     fi
   else
diff --git a/m4/timegm.m4 b/m4/timegm.m4
index 8ab265e65f..6da0780769 100644
--- a/m4/timegm.m4
+++ b/m4/timegm.m4
@@ -1,4 +1,4 @@
-# timegm.m4 serial 15
+# timegm.m4 serial 16
 dnl Copyright (C) 2003, 2007, 2009-2023 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -8,7 +8,6 @@ AC_DEFUN([gl_FUNC_TIMEGM]
 [
   AC_REQUIRE([gl_TIME_H_DEFAULTS])
   AC_REQUIRE([gl_FUNC_MKTIME_WORKS])
-  REPLACE_TIMEGM=0
   gl_CHECK_FUNCS_ANDROID([timegm], [[#include <time.h>]])
   if test $ac_cv_func_timegm = yes; then
     if test "$gl_cv_func_working_mktime" != yes; then
diff --git a/m4/timespec_get.m4 b/m4/timespec_get.m4
index 72b580fbe6..7a00bbcde7 100644
--- a/m4/timespec_get.m4
+++ b/m4/timespec_get.m4
@@ -1,4 +1,4 @@
-# timespec_get.m4 serial 5
+# timespec_get.m4 serial 6
 dnl Copyright (C) 2021-2023 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -12,7 +12,6 @@ AC_DEFUN([gl_FUNC_TIMESPEC_GET]
   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
 
   AC_REQUIRE([gl_CHECK_FUNC_TIMESPEC_GET])
-  REPLACE_TIMESPEC_GET=0
   if test $gl_cv_func_timespec_get != yes; then
     HAVE_TIMESPEC_GET=0
     case "$gl_cv_onwards_func_timespec_get" in
diff --git a/m4/tzset.m4 b/m4/tzset.m4
index 72e935fe18..45e9233971 100644
--- a/m4/tzset.m4
+++ b/m4/tzset.m4
@@ -1,4 +1,4 @@
-# serial 16
+# serial 17
 
 # Copyright (C) 2003, 2007, 2009-2023 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
@@ -11,7 +11,6 @@ AC_DEFUN([gl_FUNC_TZSET]
 [
   AC_REQUIRE([gl_TIME_H_DEFAULTS])
   AC_REQUIRE([AC_CANONICAL_HOST])
-  REPLACE_TZSET=0
   case "$host_os" in
     mingw*) REPLACE_TZSET=1 ;;
   esac
-- 
2.34.1

>From 3a09766f1af9498d79f312f43fe67e7ee02a9347 Mon Sep 17 00:00:00 2001
From: Bruno Haible <br...@clisp.org>
Date: Sat, 29 Jul 2023 18:22:50 +0200
Subject: [PATCH 2/2] time-h: Simplify after 2017-05-01 change.

* m4/time_h.m4 (gl_TIME_H_DEFAULTS): Don't provide a default value for
GNULIB_GETTIMEOFDAY.
---
 ChangeLog    | 4 ++++
 m4/time_h.m4 | 6 +-----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index fd83cb6770..96c217a02e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2023-07-29  Bruno Haible  <br...@clisp.org>
 
+	time-h: Simplify after 2017-05-01 change.
+	* m4/time_h.m4 (gl_TIME_H_DEFAULTS): Don't provide a default value for
+	GNULIB_GETTIMEOFDAY.
+
 	time-h: Obey GNULIB_POSIXCHECK, not GNULIB_PORTCHECK.
 	* lib/time.in.h (timespec_get, timespec_getres, time, nanosleep, tzset,
 	mktime, localtime_r, gmtime_r, localtime, strptime, ctime, strftime,
diff --git a/m4/time_h.m4 b/m4/time_h.m4
index 8cc9ac8792..632d18fc07 100644
--- a/m4/time_h.m4
+++ b/m4/time_h.m4
@@ -2,7 +2,7 @@
 
 # Copyright (C) 2000-2001, 2003-2007, 2009-2023 Free Software Foundation, Inc.
 
-# serial 23
+# serial 24
 
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
@@ -176,8 +176,4 @@ AC_DEFUN([gl_TIME_H_DEFAULTS]
   REPLACE_TIMEGM=0;                      AC_SUBST([REPLACE_TIMEGM])
   REPLACE_TIMESPEC_GET=0;                AC_SUBST([REPLACE_TIMESPEC_GET])
   REPLACE_TZSET=0;                       AC_SUBST([REPLACE_TZSET])
-
-  dnl Hack so that the time module doesn't depend on the sys_time module.
-  dnl Default GNULIB_GETTIMEOFDAY to 0 if sys_time is absent.
-  : ${GNULIB_GETTIMEOFDAY=0};            AC_SUBST([GNULIB_GETTIMEOFDAY])
 ])
-- 
2.34.1

Reply via email to