bug-gnulib
[Top][All Lists]
Advanced

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

Re: split module gettimeofday


From: Jim Meyering
Subject: Re: split module gettimeofday
Date: Tue, 2 May 2017 16:20:53 +0900

On Tue, May 2, 2017 at 1:39 AM, Bruno Haible <address@hidden> wrote:
> 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.

Thank you for all of those fixes and improvements.



reply via email to

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