Fix gnulib to not replace gmtime() and localtime()

It cause issues when <ctime> latter undefine the gmtime/localtime macros
to access the real function.

* lib/Makefile.am, lib/time.in.h, m4/gettimeofday.m4, m4/time_h.m4:
These changes are mostly based on the patch posted in
http://permalink.gmane.org/gmane.comp.lib.gnulib.bugs/29229 but
with the prototype of gmtime() and localtime() fixed.
This commit is contained in:
Alexandre Duret-Lutz 2013-07-18 19:55:45 +02:00
parent 96f32c73fb
commit 16b7206dd9
4 changed files with 51 additions and 4 deletions

View file

@ -187,6 +187,40 @@ _GL_CXXALIASWARN (gmtime_r);
# endif
# endif
/* 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 @REPLACE_LOCALTIME@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef localtime
# define localtime rpl_localtime
# endif
_GL_FUNCDECL_RPL (localtime, struct tm *, (time_t const *__timer)
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (localtime, struct tm *, (time_t const *__timer));
# else
# if ! @HAVE_LOCALTIME@
_GL_FUNCDECL_SYS (localtime, struct tm *, (time_t const *__timer)
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (localtime, struct tm *, (time_t const *__timer));
# endif
# if @REPLACE_GMTIME@
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
# undef gmtime
# define gmtime rpl_gmtime
# endif
_GL_FUNCDECL_RPL (gmtime, struct tm *, (time_t const *__timer)
_GL_ARG_NONNULL ((1)));
_GL_CXXALIAS_RPL (gmtime, struct tm *, (time_t const *__timer));
# else
# if ! @HAVE_GMTIME@
_GL_FUNCDECL_SYS (gmtime, struct tm *, (time_t const *__timer)
_GL_ARG_NONNULL ((1)));
# endif
_GL_CXXALIAS_SYS (gmtime, struct tm *, (time_t const *__timer));
# endif
/* Parse BUF as a time stamp, assuming FORMAT specifies its layout, and store
the resulting broken-down time into TM. See
<http://www.opengroup.org/susv3xsh/strptime.html>. */