bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

split module gettimeofday


From: Bruno Haible
Subject: split module gettimeofday
Date: Mon, 01 May 2017 18:39:17 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-75-generic; KDE/5.18.0; x86_64; ; )

Currently:
  - gettimeofday.c contains code that is not related to gettimeofday at all -
    a tzset() override, for example.
  - The user who wants a fixed 'tzset' function will also get a 'gettimeofday'
    replacement, for no good reason.
  - The declaration of tzset is not done in our replacement <time.h> but through
    the old idiom (a #define in config.h) - which causes problems in C++ mode.
  - Because of this hard-to-maintain complexity, a dependency from module 'time'
    to module 'gettimeofday' has been added on 2013-12-17.

This gets in the way of defining an override of tzset regarding the TZ
environment variable. So let me split module gettimeofday first.

Other bugs in this area:
  - gettimeofday.m4 lacks an AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
    that would ensure that the assignments REPLACE_GMTIME=1 and
    REPLACE_LOCALTIME=1 are actually effective.
  - m4_ifdef([gl_FUNC_TZSET_CLOBBER] is a bad way to test whether the 'tzset'
    module is present. See
    https://lists.gnu.org/archive/html/bug-gnulib/2017-04/msg00117.html


2017-05-01  Bruno Haible  <address@hidden>

        New module 'localtime-buffer', split off from module 'gettimeofday'.
        * lib/localtime-buffer.h: New file.
        * lib/localtime-buffer.c: New file, extracted from lib/gettimeofday.c.
        * lib/time.in.h (tzset): New declaration.
        (localtime, gmtime): Don't test GNULIB_GETTIMEOFDAY.
        * lib/tzset.c: New file, extracted from lib/gettimeofday.c.
        * lib/gettimeofday.c: Include localtime-buffer.h. Remove code that was
        moved to lib/localtime-buffer.c or lib/tzset.c.
        * m4/localtime-buffer.m4: New file.
        * m4/time_h.m4 (gl_HEADER_TIME_H_DEFAULTS): Initialize GNULIB_TZSET,
        HAVE_TZSET, REPLACE_TZSET.
        * m4/tzset.m4 (gl_FUNC_TZSET): Move code from m4/gettimeofday.m4 to
        here, with modifications. Set HAVE_TZSET, REPLACE_TZSET. Invoke
        gl_LOCALTIME_BUFFER_NEEDED.
        (gl_FUNC_TZSET_CLOBBER): Don't require gl_HEADER_SYS_TIME_H; not needed
        since 2007-01-18.
        * m4/gettimeofday.m4 (gl_FUNC_GETTIMEOFDAY): Remove code that deals with
        tzset.
        (gl_FUNC_GETTIMEOFDAY_CLOBBER): Require gl_LOCALTIME_BUFFER_DEFAULTS.
        Invoke gl_LOCALTIME_BUFFER_NEEDED instead of
        gl_GETTIMEOFDAY_REPLACE_LOCALTIME.
        (gl_GETTIMEOFDAY_REPLACE_LOCALTIME): Remove macro.
        * modules/localtime-buffer: New file.
        * modules/time (Depends-on): Remove 'gettimeofday'.
        (Makefile.am): Substitute GNULIB_TZSET, HAVE_TZSET,
        REPLACE_TZSET. Don't substitute GNULIB_GETTIMEOFDAY.
        * modules/tzset (Description): Enable hyperlink to POSIX spec.
        (Files): Add lib/tzset.c.
        (Depends-on): Remove gettimeofday. Add localtime-buffer, time.
        (configure.ac): Arrange to conditionally compile lib/tzset.c. Invoke
        gl_TIME_MODULE_INDICATOR.
        * modules/gettimeofday (Depends-on): Add localtime-buffer.

diff --git a/lib/gettimeofday.c b/lib/gettimeofday.c
index a4a71a7..0d64885 100644
--- a/lib/gettimeofday.c
+++ b/lib/gettimeofday.c
@@ -29,72 +29,7 @@
 # include <windows.h>
 #endif
 
-#if GETTIMEOFDAY_CLOBBERS_LOCALTIME || TZSET_CLOBBERS_LOCALTIME
-
-/* Work around the bug in some systems whereby gettimeofday clobbers
-   the static buffer that localtime uses for its return value.  The
-   gettimeofday function from Mac OS X 10.0.4 (i.e., Darwin 1.3.7) has
-   this problem.  The tzset replacement is necessary for at least
-   Solaris 2.5, 2.5.1, and 2.6.  */
-
-static struct tm tm_zero_buffer;
-static struct tm *localtime_buffer_addr = &tm_zero_buffer;
-
-# undef localtime
-extern struct tm *localtime (time_t const *);
-
-# undef gmtime
-extern struct tm *gmtime (time_t const *);
-
-/* This is a wrapper for localtime.  It is used only on systems for which
-   gettimeofday clobbers the static buffer used for localtime's result.
-
-   On the first call, record the address of the static buffer that
-   localtime uses for its result.  */
-
-struct tm *
-rpl_localtime (time_t const *timep)
-{
-  struct tm *tm = localtime (timep);
-
-  if (localtime_buffer_addr == &tm_zero_buffer)
-    localtime_buffer_addr = tm;
-
-  return tm;
-}
-
-/* Same as above, since gmtime and localtime use the same buffer.  */
-struct tm *
-rpl_gmtime (time_t const *timep)
-{
-  struct tm *tm = gmtime (timep);
-
-  if (localtime_buffer_addr == &tm_zero_buffer)
-    localtime_buffer_addr = tm;
-
-  return tm;
-}
-
-#endif /* GETTIMEOFDAY_CLOBBERS_LOCALTIME || TZSET_CLOBBERS_LOCALTIME */
-
-#if TZSET_CLOBBERS_LOCALTIME
-
-# undef tzset
-extern void tzset (void);
-
-/* This is a wrapper for tzset, for systems on which tzset may clobber
-   the static buffer used for localtime's result.  */
-void
-rpl_tzset (void)
-{
-  /* Save and restore the contents of the buffer used for localtime's
-     result around the call to tzset.  */
-  struct tm save = *localtime_buffer_addr;
-  tzset ();
-  *localtime_buffer_addr = save;
-}
-
-#endif
+#include "localtime-buffer.h"
 
 #ifdef WINDOWS_NATIVE
 
@@ -119,7 +54,11 @@ initialize (void)
 
 /* This is a wrapper for gettimeofday.  It is used only on systems
    that lack this function, or whose implementation of this function
-   causes problems.  */
+   causes problems.
+   Work around the bug in some systems whereby gettimeofday clobbers
+   the static buffer that localtime uses for its return value.  The
+   gettimeofday function from Mac OS X 10.0.4 (i.e., Darwin 1.3.7) has
+   this problem.  */
 
 int
 gettimeofday (struct timeval *restrict tv, void *restrict tz)
diff --git a/lib/localtime-buffer.c b/lib/localtime-buffer.c
new file mode 100644
index 0000000..7620b30
--- /dev/null
+++ b/lib/localtime-buffer.c
@@ -0,0 +1,58 @@
+/* Provide access to the last buffer returned by localtime() or gmtime().
+
+   Copyright (C) 2001-2003, 2005-2007, 2009-2017 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
+
+/* written by Jim Meyering */
+
+#include <config.h>
+
+/* Specification.  */
+#include "localtime-buffer.h"
+
+#if GETTIMEOFDAY_CLOBBERS_LOCALTIME || TZSET_CLOBBERS_LOCALTIME
+
+static struct tm tm_zero_buffer;
+struct tm *localtime_buffer_addr = &tm_zero_buffer;
+
+/* This is a wrapper for localtime.
+
+   On the first call, record the address of the static buffer that
+   localtime uses for its result.  */
+
+struct tm *
+rpl_localtime (time_t const *timep)
+{
+  struct tm *tm = localtime (timep);
+
+  if (localtime_buffer_addr == &tm_zero_buffer)
+    localtime_buffer_addr = tm;
+
+  return tm;
+}
+
+/* Same as above, since gmtime and localtime use the same buffer.  */
+struct tm *
+rpl_gmtime (time_t const *timep)
+{
+  struct tm *tm = gmtime (timep);
+
+  if (localtime_buffer_addr == &tm_zero_buffer)
+    localtime_buffer_addr = tm;
+
+  return tm;
+}
+
+#endif
diff --git a/lib/localtime-buffer.h b/lib/localtime-buffer.h
new file mode 100644
index 0000000..cd958de
--- /dev/null
+++ b/lib/localtime-buffer.h
@@ -0,0 +1,27 @@
+/* Provide access to the last buffer returned by localtime() or gmtime().
+
+   Copyright (C) 2001-2003, 2005-2007, 2009-2017 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
+
+/* written by Jim Meyering */
+
+#include <time.h>
+
+#if GETTIMEOFDAY_CLOBBERS_LOCALTIME || TZSET_CLOBBERS_LOCALTIME
+
+/* The address of the last buffer returned by localtime() or gmtime().  */
+extern struct tm *localtime_buffer_addr;
+
+#endif
diff --git a/lib/localtime.c b/lib/localtime.c
index 07b532a..5316930 100644
--- a/lib/localtime.c
+++ b/lib/localtime.c
@@ -19,7 +19,7 @@
 /* Specification.  */
 #include <time.h>
 
-/* Keep consistent with gettimeofday.c!  */
+/* Keep consistent with localtime-buffer.c!  */
 #if !(GETTIMEOFDAY_CLOBBERS_LOCALTIME || TZSET_CLOBBERS_LOCALTIME)
 
 # include <stdlib.h>
diff --git a/lib/time.in.h b/lib/time.in.h
index 8f748ec..5246700 100644
--- a/lib/time.in.h
+++ b/lib/time.in.h
@@ -120,6 +120,24 @@ _GL_CXXALIAS_SYS (nanosleep, int,
 _GL_CXXALIASWARN (nanosleep);
 # endif
 
+/* Initialize time conversion information.  */
+# if @GNULIB_TZSET@
+#  if @REPLACE_TZSET@
+#   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
+#    undef tzset
+#    define tzset rpl_tzset
+#   endif
+_GL_FUNCDECL_RPL (tzset, void, (void));
+_GL_CXXALIAS_RPL (tzset, void, (void));
+#  else
+#   if ! @HAVE_TZSET@
+_GL_FUNCDECL_SYS (tzset, void, (void));
+#   endif
+_GL_CXXALIAS_SYS (tzset, void, (void));
+#  endif
+_GL_CXXALIASWARN (tzset);
+# endif
+
 /* Return the 'time_t' representation of TP and normalize TP.  */
 # if @GNULIB_MKTIME@
 #  if @REPLACE_MKTIME@
@@ -187,7 +205,7 @@ _GL_CXXALIASWARN (gmtime_r);
 /* Convert TIMER to RESULT, assuming local time and UTC respectively.  See
    <http://www.opengroup.org/susv3xsh/localtime.html> and
    <http://www.opengroup.org/susv3xsh/gmtime.html>.  */
-# if @GNULIB_LOCALTIME@ || @GNULIB_GETTIMEOFDAY@
+# if @GNULIB_LOCALTIME@ || @REPLACE_LOCALTIME@
 #  if @REPLACE_LOCALTIME@
 #   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #    undef localtime
@@ -202,7 +220,7 @@ _GL_CXXALIAS_SYS (localtime, struct tm *, (time_t const 
*__timer));
 _GL_CXXALIASWARN (localtime);
 # endif
 
-# if @GNULIB_GETTIMEOFDAY@
+# if 0 || @REPLACE_GMTIME@
 #  if @REPLACE_GMTIME@
 #   if !(defined __cplusplus && defined GNULIB_NAMESPACE)
 #    undef gmtime
diff --git a/lib/tzset.c b/lib/tzset.c
new file mode 100644
index 0000000..1cb9822
--- /dev/null
+++ b/lib/tzset.c
@@ -0,0 +1,48 @@
+/* Provide tzset for systems that don't have it or for which it's broken.
+
+   Copyright (C) 2001-2003, 2005-2007, 2009-2017 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
+
+/* written by Jim Meyering */
+
+#include <config.h>
+
+/* Specification.  */
+#include <time.h>
+
+#include "localtime-buffer.h"
+
+/* This is a wrapper for tzset, for systems on which tzset may clobber
+   the static buffer used for localtime's result.
+   Work around the bug in some systems whereby tzset clobbers the
+   static buffer that localtime uses for its return value.  The
+   tzset function from Solaris 2.5, 2.5.1, and 2.6 has this problem.  */
+
+void
+tzset (void)
+#undef tzset
+{
+#if TZSET_CLOBBERS_LOCALTIME
+  /* Save and restore the contents of the buffer used for localtime's
+     result around the call to tzset.  */
+  struct tm save = *localtime_buffer_addr;
+#endif
+
+  tzset ();
+
+#if TZSET_CLOBBERS_LOCALTIME
+  *localtime_buffer_addr = save;
+#endif
+}
diff --git a/m4/gettimeofday.m4 b/m4/gettimeofday.m4
index 742b6c9..34adc64 100644
--- a/m4/gettimeofday.m4
+++ b/m4/gettimeofday.m4
@@ -54,19 +54,6 @@ int gettimeofday (struct timeval *restrict, struct timezone 
*restrict);
     if test $REPLACE_STRUCT_TIMEVAL = 1; then
       REPLACE_GETTIMEOFDAY=1
     fi
-    m4_ifdef([gl_FUNC_TZSET_CLOBBER], [
-      gl_FUNC_TZSET_CLOBBER
-      case "$gl_cv_func_tzset_clobber" in
-        *yes)
-          REPLACE_GETTIMEOFDAY=1
-          gl_GETTIMEOFDAY_REPLACE_LOCALTIME
-          AC_DEFINE([tzset], [rpl_tzset],
-            [Define to rpl_tzset if the wrapper function should be used.])
-          AC_DEFINE([TZSET_CLOBBERS_LOCALTIME], [1],
-            [Define if tzset clobbers localtime's static buffer.])
-          ;;
-      esac
-    ])
   fi
   AC_DEFINE_UNQUOTED([GETTIMEOFDAY_TIMEZONE], [$gl_gettimeofday_timezone],
     [Define this to 'void' or 'struct timezone' to match the system's
@@ -85,6 +72,7 @@ AC_DEFUN([gl_FUNC_GETTIMEOFDAY_CLOBBER],
 [
  AC_REQUIRE([gl_HEADER_SYS_TIME_H])
  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+ AC_REQUIRE([gl_LOCALTIME_BUFFER_DEFAULTS])
 
  AC_CACHE_CHECK([whether gettimeofday clobbers localtime buffer],
   [gl_cv_func_gettimeofday_clobber],
@@ -119,17 +107,12 @@ AC_DEFUN([gl_FUNC_GETTIMEOFDAY_CLOBBER],
  case "$gl_cv_func_gettimeofday_clobber" in
    *yes)
      REPLACE_GETTIMEOFDAY=1
-     gl_GETTIMEOFDAY_REPLACE_LOCALTIME
      AC_DEFINE([GETTIMEOFDAY_CLOBBERS_LOCALTIME], [1],
        [Define if gettimeofday clobbers the localtime buffer.])
+     gl_LOCALTIME_BUFFER_NEEDED
      ;;
  esac
 ])
 
-AC_DEFUN([gl_GETTIMEOFDAY_REPLACE_LOCALTIME], [
-  REPLACE_GMTIME=1
-  REPLACE_LOCALTIME=1
-])
-
 # Prerequisites of lib/gettimeofday.c.
 AC_DEFUN([gl_PREREQ_GETTIMEOFDAY], [:])
diff --git a/m4/localtime-buffer.m4 b/m4/localtime-buffer.m4
new file mode 100644
index 0000000..3965b5d
--- /dev/null
+++ b/m4/localtime-buffer.m4
@@ -0,0 +1,21 @@
+# localtime-buffer.m4 serial 1
+dnl Copyright (C) 2017 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_LOCALTIME_BUFFER_DEFAULTS],
+[
+  NEED_LOCALTIME_BUFFER=0
+])
+
+dnl Macro invoked from other modules, to signal that the compilation of
+dnl module 'localtime-buffer' is needed.
+AC_DEFUN([gl_LOCALTIME_BUFFER_NEEDED],
+[
+  AC_REQUIRE([gl_LOCALTIME_BUFFER_DEFAULTS])
+  AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
+  NEED_LOCALTIME_BUFFER=1
+  REPLACE_GMTIME=1
+  REPLACE_LOCALTIME=1
+])
diff --git a/m4/time_h.m4 b/m4/time_h.m4
index e0f663e..f52b601 100644
--- a/m4/time_h.m4
+++ b/m4/time_h.m4
@@ -113,11 +113,13 @@ AC_DEFUN([gl_HEADER_TIME_H_DEFAULTS],
   GNULIB_TIMEGM=0;                       AC_SUBST([GNULIB_TIMEGM])
   GNULIB_TIME_R=0;                       AC_SUBST([GNULIB_TIME_R])
   GNULIB_TIME_RZ=0;                      AC_SUBST([GNULIB_TIME_RZ])
+  GNULIB_TZSET=0;                        AC_SUBST([GNULIB_TZSET])
   dnl Assume proper GNU behavior unless another module says otherwise.
   HAVE_DECL_LOCALTIME_R=1;               AC_SUBST([HAVE_DECL_LOCALTIME_R])
   HAVE_NANOSLEEP=1;                      AC_SUBST([HAVE_NANOSLEEP])
   HAVE_STRPTIME=1;                       AC_SUBST([HAVE_STRPTIME])
   HAVE_TIMEGM=1;                         AC_SUBST([HAVE_TIMEGM])
+  HAVE_TZSET=1;                          AC_SUBST([HAVE_TZSET])
   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.
@@ -127,6 +129,7 @@ AC_DEFUN([gl_HEADER_TIME_H_DEFAULTS],
   REPLACE_NANOSLEEP=GNULIB_PORTCHECK;    AC_SUBST([REPLACE_NANOSLEEP])
   REPLACE_STRFTIME=GNULIB_PORTCHECK;     AC_SUBST([REPLACE_STRFTIME])
   REPLACE_TIMEGM=GNULIB_PORTCHECK;       AC_SUBST([REPLACE_TIMEGM])
+  REPLACE_TZSET=GNULIB_PORTCHECK;        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.
diff --git a/m4/tzset.m4 b/m4/tzset.m4
index e9e543c..20939e9 100644
--- a/m4/tzset.m4
+++ b/m4/tzset.m4
@@ -1,4 +1,4 @@
-# serial 7
+# serial 8
 
 # Copyright (C) 2003, 2007, 2009-2017 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
@@ -13,13 +13,31 @@
 
 # Written by Paul Eggert and Jim Meyering.
 
-# A placeholder to ensure that this m4 file gets included by aclocal.
-AC_DEFUN([gl_FUNC_TZSET], [])
+AC_DEFUN([gl_FUNC_TZSET],
+[
+  AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
+  AC_REQUIRE([gl_LOCALTIME_BUFFER_DEFAULTS])
+  AC_CHECK_FUNCS_ONCE([tzset])
+  if test $ac_cv_func_tzset = no; then
+    HAVE_TZSET=0
+  fi
+  gl_FUNC_TZSET_CLOBBER
+  case "$gl_cv_func_tzset_clobber" in
+    *yes)
+      REPLACE_TZSET=1
+      AC_DEFINE([TZSET_CLOBBERS_LOCALTIME], [1],
+        [Define if tzset clobbers localtime's static buffer.])
+      gl_LOCALTIME_BUFFER_NEEDED
+      ;;
+    *)
+      REPLACE_TZSET=0
+      ;;
+  esac
+])
 
 # Set gl_cv_func_tzset_clobber.
 AC_DEFUN([gl_FUNC_TZSET_CLOBBER],
 [
-  AC_REQUIRE([gl_HEADER_SYS_TIME_H])
   AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
   AC_CACHE_CHECK([whether tzset clobbers localtime buffer],
                  gl_cv_func_tzset_clobber,
diff --git a/modules/gettimeofday b/modules/gettimeofday
index b4bdcc3..106e7a7 100644
--- a/modules/gettimeofday
+++ b/modules/gettimeofday
@@ -7,6 +7,7 @@ m4/gettimeofday.m4
 
 Depends-on:
 sys_time
+localtime-buffer [test $NEED_LOCALTIME_BUFFER = 1]
 
 configure.ac:
 gl_FUNC_GETTIMEOFDAY
diff --git a/modules/localtime-buffer b/modules/localtime-buffer
new file mode 100644
index 0000000..e511d43
--- /dev/null
+++ b/modules/localtime-buffer
@@ -0,0 +1,25 @@
+Description:
+Access to the internal buffer of the localtime() function and the gmtime() 
function.
+
+Files:
+lib/localtime-buffer.h
+lib/localtime-buffer.c
+m4/localtime-buffer.m4
+
+Depends-on:
+time            [false]
+
+configure.ac:
+AC_REQUIRE([gl_LOCALTIME_BUFFER_DEFAULTS])
+AC_LIBOBJ([localtime-buffer])
+
+Makefile.am:
+
+Include:
+"localtime-buffer.h"
+
+License:
+LGPLv2+
+
+Maintainer:
+all
diff --git a/modules/time b/modules/time
index 5cb8ac2..c235ac8 100644
--- a/modules/time
+++ b/modules/time
@@ -7,7 +7,6 @@ m4/time_h.m4
 
 Depends-on:
 extensions
-gettimeofday
 include_next
 snippet/arg-nonnull
 snippet/c++defs
@@ -31,7 +30,6 @@ time.h: time.in.h $(top_builddir)/config.status $(CXXDEFS_H) 
$(ARG_NONNULL_H) $(
              -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \
              -e 's|@''NEXT_TIME_H''@|$(NEXT_TIME_H)|g' \
              -e 's/@''GNULIB_CTIME''@/$(GNULIB_CTIME)/g' \
-             -e 's/@''GNULIB_GETTIMEOFDAY''@/$(GNULIB_GETTIMEOFDAY)/g' \
              -e 's/@''GNULIB_LOCALTIME''@/$(GNULIB_LOCALTIME)/g' \
              -e 's/@''GNULIB_MKTIME''@/$(GNULIB_MKTIME)/g' \
              -e 's/@''GNULIB_NANOSLEEP''@/$(GNULIB_NANOSLEEP)/g' \
@@ -40,11 +38,13 @@ time.h: time.in.h $(top_builddir)/config.status 
$(CXXDEFS_H) $(ARG_NONNULL_H) $(
              -e 's/@''GNULIB_TIMEGM''@/$(GNULIB_TIMEGM)/g' \
              -e 's/@''GNULIB_TIME_R''@/$(GNULIB_TIME_R)/g' \
              -e 's/@''GNULIB_TIME_RZ''@/$(GNULIB_TIME_RZ)/g' \
+             -e 's/@''GNULIB_TZSET''@/$(GNULIB_TZSET)/g' \
              -e 's|@''HAVE_DECL_LOCALTIME_R''@|$(HAVE_DECL_LOCALTIME_R)|g' \
              -e 's|@''HAVE_NANOSLEEP''@|$(HAVE_NANOSLEEP)|g' \
              -e 's|@''HAVE_STRPTIME''@|$(HAVE_STRPTIME)|g' \
              -e 's|@''HAVE_TIMEGM''@|$(HAVE_TIMEGM)|g' \
              -e 's|@''HAVE_TIMEZONE_T''@|$(HAVE_TIMEZONE_T)|g' \
+             -e 's|@''HAVE_TZSET''@|$(HAVE_TZSET)|g' \
              -e 's|@''REPLACE_CTIME''@|$(REPLACE_CTIME)|g' \
              -e 's|@''REPLACE_GMTIME''@|$(REPLACE_GMTIME)|g' \
              -e 's|@''REPLACE_LOCALTIME''@|$(REPLACE_LOCALTIME)|g' \
@@ -53,6 +53,7 @@ time.h: time.in.h $(top_builddir)/config.status $(CXXDEFS_H) 
$(ARG_NONNULL_H) $(
              -e 's|@''REPLACE_NANOSLEEP''@|$(REPLACE_NANOSLEEP)|g' \
              -e 's|@''REPLACE_STRFTIME''@|$(REPLACE_STRFTIME)|g' \
              -e 's|@''REPLACE_TIMEGM''@|$(REPLACE_TIMEGM)|g' \
+             -e 's|@''REPLACE_TZSET''@|$(REPLACE_TZSET)|g' \
              -e 
's|@''PTHREAD_H_DEFINES_STRUCT_TIMESPEC''@|$(PTHREAD_H_DEFINES_STRUCT_TIMESPEC)|g'
 \
              -e 
's|@''SYS_TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(SYS_TIME_H_DEFINES_STRUCT_TIMESPEC)|g'
 \
              -e 
's|@''TIME_H_DEFINES_STRUCT_TIMESPEC''@|$(TIME_H_DEFINES_STRUCT_TIMESPEC)|g' \
diff --git a/modules/tzset b/modules/tzset
index 8fa9ee6..5f036b0 100644
--- a/modules/tzset
+++ b/modules/tzset
@@ -1,14 +1,20 @@
 Description:
-tzset - initialize time conversion information
+tzset() function: initialize time conversion information.
 
 Files:
+lib/tzset.c
 m4/tzset.m4
 
 Depends-on:
-gettimeofday
+time
+localtime-buffer [test $NEED_LOCALTIME_BUFFER = 1]
 
 configure.ac:
 gl_FUNC_TZSET
+if test $HAVE_TZSET = 0 || test $REPLACE_TZSET = 1; then
+  AC_LIBOBJ([tzset])
+fi
+gl_TIME_MODULE_INDICATOR([tzset])
 
 Makefile.am:
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]