+2007-02-12 Paul Eggert <eggert@cs.ucla.edu>
+
+ New module 'time', so that apps can include <time.h> as per
+ POSIX and GNU instead of separate include files like time_r.h
+ and timegm.h. This implementation tries out a simpler approach
+ for replacing decls in standard include files (as compared to
+ the string module), somewhat as an experiment.
+
+ * config/srclist.txt: Comment out mktime.c for now.
+ * doc/gnulib-tool.texi (Initial import): Don't use time_r as an example
+ since it doesn't apply any more. Use generic wording instead.
+ * MODULES.html.sh (Support for systems lacking POSIX:2001): New module
+ 'time'.
+ * lib/time_.h, m4/time_h.m4, modules/time: New files.
+ * lib/strptime.h, lib/time_r.h, lib/timegm.h: Remove.
+ * lib/mktime.c: Include config.h depending on _LIBC, not HAVE_CONFIG_H.
+ Don't include <sys/types.h>; no longer needed since we assume C89.
+ * lib/mktime.c: Don't include "time_r.h"; no longer needed.
+ * lib/strftime.c: Likewise.
+ * lib/time_r.c: Likewise.
+ * lib/nanosleep.c (nanosleep): #undef after include files, not before.
+ * lib/nanosleep.c: Include <time.h> first, to check interface.
+ * lib/strptime.c: Likewise.
+ * lib/time_r.c: Likewise.
+ * lib/timegm.c: Likewise.
+ * lib/strptime.c: Don't include strptime.h or time_r.h; no longer
+ needed.
+ * lib/timegm.c: Don't include timegm.h; no longer needed.
+ * lib/timespec.h: Don't include <sys/time.h> before <time.h>;
+ time.h now handles any problems in that area.
+ (struct timespec, nanosleep): Remove; time.h now arranges for these.
+ * lib/xnanosleep.c: Don't include timespec.h; no longer needed now
+ that time.h defines struct timespec.
+ * m4/nanosleep.m4 (gl_FUNC_NANOSLEEP): Check that nanosleep is declared.
+ Set REPLACE_NANOSLEEP. Don't AC_DEFINE nanosleep; the time module now
+ handles that.
+ * m4/strptime.m4 (gl_FUNC_STPRTIME): Set REPLACE_STRPTIME.
+ * m4/time_r.m4 (gl_TIME_R): Don't define HAVE_TIME_R_POSIX; no longer
+ needed. Set REPLACE_LOCALTIME.
+ * m4/timegm.m4 (gl_FUNC_TIMEGM): Set REPLACE_TIMEGM.
+ * m4/timespec.m4 (gl_CHECK_TYPE_STRUCT_TIMESPEC): Move to time_h.m4.
+ (gl_TIMESPEC): Don't check for sys/time.h or struct timespec or
+ nanosleep; time_h.m4 now does that. Don't require
+ gl_USE_SYSTEM_EXTENSIONS; no longer needed directly, and the time
+ module handles this now.
+ * modules/getdate (Depends-on): Remove timespec. Add time.
+ * modules/nanosleep (Depends-on): Likewise.
+ * modules/stat-time (Depends-on): Likewise.
+ * modules/nanosleep (Include): Include time.h, not timespec.h.
+ * modules/strptime (Files): Remove lib/strptime.h.
+ (Depends-on): Add extensions, time.
+ (Include): Include time.h, not strptime.h.
+ * modules/time_r (Files): Remove lib/time_r.h.
+ (Depends-on): Add time.
+ (Include): Include time.h, not time_r.h.
+ * modules/timegm: Likewise.
+ * modules/timespec (Description): Now does timespec-related decls
+ of our own, instead of struct timespec itself.
+ (Depends-on): Add time; remove extensions.
+ (Maintainer): Add self.
+ * modules/utimecmp (Depends-on): Add time; remove timespec.
+ * modules/utimens (Depends-on): Likewise.
+ * modules/xnanosleep (Depends-on): Likewise.
+
2007-02-11 Bruno Haible <bruno@clisp.org>
* lib/c-strstr.c: Include allocsa.h.
func_module readlink
func_module lstat
func_module tempname
+ func_module time
func_module time_r
func_module timespec
func_module nanosleep
-# $Id: srclist.txt,v 1.144 2007-02-10 14:46:17 karl Exp $
+# $Id: srclist.txt,v 1.145 2007-02-12 18:49:19 eggert Exp $
# Files for which we are not the source. See ./srclistvars.sh for the
# variable definitions.
$LIBCSRC/stdlib/strtoul.c lib gpl
# (no more strtok_r.h) $LIBCSRC/string/strtok_r.c lib gpl
# (gnulib needs config.h?) $LIBCSRC/string/memmem.c lib gpl
-$LIBCSRC/time/mktime.c lib gpl
+#$LIBCSRC/time/mktime.c lib gpl
#
# http://sourceware.org/bugzilla/show_bug.cgi?id=1439
is evaluated when compiling all source code files, that want to make
use of @code{strdup}.
-When an include file is provided by Gnulib
-you shouldn't try to include the corresponding system header files
-yourself, but let the gnulib header file do it. The ordering
-of the definition for some symbols may be significant; the Gnulib
-header files take care of that.
-
-For example, to use the @code{time_r} gnulib module you should
-use include header file provided by the gnulib, and so
-@samp{#include "time_r.h"}, but you shouldn't explicitly
-@samp{#include <time.h>} as it is already done in @file{time_r.h}
-before the redefinition of some symbols.
+In the usual case where Autoconf is creating a @file{config.h} file,
+you should include @file{config.h} first, before any other include
+file. That way, for example, if @file{config.h} defines
+@samp{restrict} to be the empty string on a pre-C99 host, the
+definition is consistent for all include files.
+
+You should include Gnulib-provided headers before system headers,
+so that Gnulib-provided headers can adjust how a system header
+behaves.
A final word of warning: Gnulib currently assumes it will be
responsible for @emph{all} functions that end up in the Autoconf
/* Convert a `struct tm' to a time_t value.
- Copyright (C) 1993-1999, 2002-2005, 2006 Free Software Foundation, Inc.
+ Copyright (C) 1993-1999, 2002-2005, 2006, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Paul Eggert <eggert@twinsun.com>.
mktime. */
/* #define DEBUG 1 */
-#ifdef HAVE_CONFIG_H
+#ifndef _LIBC
# include <config.h>
#endif
# define LEAP_SECONDS_POSSIBLE 1
#endif
-#include <sys/types.h> /* Some systems define `time_t' here. */
#include <time.h>
#include <limits.h>
#ifndef _LIBC
-/* Portable standalone applications should supply a "time_r.h" that
+/* Portable standalone applications should supply a <time.h> that
declares a POSIX-compliant localtime_r, for the benefit of older
implementations that lack localtime_r or have a nonstandard one.
See the gnulib time_r module for one way to implement this. */
-# include "time_r.h"
# undef __localtime_r
# define __localtime_r localtime_r
# define __mktime_internal mktime_internal
#include <config.h>
-/* Undefine nanosleep here so any prototype is not redefined to be a
- prototype for rpl_nanosleep. (they'd conflict e.g., on alpha-dec-osf3.2) */
-#undef nanosleep
+#include <time.h>
#include "timespec.h"
#include <signal.h>
#include <sys/time.h>
-#include <time.h>
-
#include <errno.h>
#include <unistd.h>
+#undef nanosleep
+
enum { BILLION = 1000 * 1000 * 1000 };
#if HAVE_BUG_BIG_NANOSLEEP
#endif
#if !HAVE_TM_GMTOFF
-/* Portable standalone applications should supply a "time_r.h" that
+/* Portable standalone applications should supply a "time.h" that
declares a POSIX-compliant localtime_r, for the benefit of older
implementations that lack localtime_r or have a nonstandard one.
See the gnulib time_r module for one way to implement this. */
-# include "time_r.h"
# undef __gmtime_r
# undef __localtime_r
# define __gmtime_r gmtime_r
#ifndef _LIBC
# include <config.h>
-# include "strptime.h"
#endif
+#include <time.h>
+
#include <assert.h>
#include <ctype.h>
#ifdef _LIBC
#endif
#include <limits.h>
#include <string.h>
-#include <time.h>
#include <stdbool.h>
#ifdef _LIBC
#endif
#ifndef _LIBC
-# include "time_r.h"
enum ptime_locale_status { not, loc, raw };
#endif
+++ /dev/null
-/* Convert a string representation of time to a tm structure.
- Copyright (C) 2001-2003, 2005, 2007 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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#ifndef GNULIB_STRPTIME_H_
-#define GNULIB_STRPTIME_H_
-
-#include <time.h>
-
-#if ! HAVE_STRPTIME
-/* See the POSIX:2001 specification
- <http://www.opengroup.org/susv3xsh/strptime.html>. */
-extern char *strptime (const char *restrict s, const char *restrict format,
- struct tm *restrict tm);
-#endif
-
-#endif /* GNULIB_STRPTIME_H_ */
--- /dev/null
+/* A more-standard <time.h>.
+
+ Copyright (C) 2007 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, write to the Free Software Foundation,
+ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
+
+/* Don't get in the way of glibc when it includes time.h merely to
+ declare a few standard symbols, rather than to declare all the
+ symbols. */
+#if defined __need_time_t || defined __need_clock_t || defined __need_timespec
+# include @ABSOLUTE_TIME_H@
+
+#elif ! defined _GL_TIME_H
+# define _GL_TIME_H
+# include @ABSOLUTE_TIME_H@
+
+# ifdef __cplusplus
+extern "C" {
+# endif
+
+/* Some systems don't define struct timespec (e.g., AIX 4.1, Ultrix 4.3).
+ Or they define it with the wrong member names or define it in <sys/time.h>
+ (e.g., FreeBSD circa 1997). */
+# if ! @TIME_H_DEFINES_STRUCT_TIMESPEC@
+# if @SYS_TIME_H_DEFINES_STRUCT_TIMESPEC@
+# include <sys/time.h>
+# else
+# undef timespec
+# define timespec rpl_timespec
+struct timespec
+{
+ time_t tv_sec;
+ long int tv_nsec;
+};
+# endif
+# endif
+
+/* Sleep for at least RQTP seconds unless interrupted, If interrupted,
+ return -1 and store the remaining time into RMTP. See
+ <http://www.opengroup.org/susv3xsh/nanosleep.html>. */
+# if @REPLACE_NANOSLEEP@
+# define nanosleep rpl_nanosleep
+int nanosleep (struct timespec const *__rqtp, struct timespec *__rmtp);
+# endif
+
+/* Convert TIMER to RESULT, assuming local time and UTC respectively. See
+ <http://www.opengroup.org/susv3xsh/localtime_r.html> and
+ <http://www.opengroup.org/susv3xsh/gmtime_r.html>. */
+# if @REPLACE_LOCALTIME_R@
+# undef localtime_r
+# define localtime_r rpl_localtime_r
+# undef gmtime_r
+# define gmtime_r rpl_gmtime_r
+struct tm *localtime_r (time_t const *restrict __timer,
+ struct tm *restrict __result);
+struct tm *gmtime_r (time_t const *restrict __timer,
+ struct tm *restrict __result);
+# 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>. */
+# if @REPLACE_STRPTIME@
+# undef strptime
+# define strptime rpl_strptime
+char *strptime (char const *restrict __buf, char const *restrict __format,
+ struct tm *restrict __tm);
+# endif
+
+/* Convert TM to a time_t value, assuming UTC. */
+# if @REPLACE_TIMEGM@
+# undef timegm
+# define timegm rpl_timegm
+time_t timegm (struct tm *__tm);
+#endif
+
+/* Encourage applications to avoid unsafe functions that can overrrun
+ buffers when given outlandish struct tm values. Portable
+ applications should use strftime (or even sprintf) instead. */
+# if GNULIB_PORTCHECK
+# undef asctime
+# define asctime eschew_asctime
+# undef asctime_r
+# define asctime_r eschew_asctime_r
+# undef ctime
+# define ctime eschew_ctime
+# undef ctime_r
+# define ctime_r eschew_ctime_r
+# endif
+
+# ifdef __cplusplus
+}
+# endif
+
+#endif
/* Reentrant time functions like localtime_r.
- Copyright (C) 2003, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2006, 2007 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
#include <config.h>
-#include "time_r.h"
+#include <time.h>
#include <string.h>
+++ /dev/null
-/* Reentrant time functions like localtime_r.
-
- Copyright (C) 2003, 2005, 2006 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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-/* Written by Paul Eggert. */
-
-#ifndef _TIME_R_H
-#define _TIME_R_H
-
-/* Include <time.h> first, since it may declare these functions with
- signatures that disagree with POSIX, and we don't want to rename
- those declarations. */
-#include <time.h>
-
-#if !HAVE_TIME_R_POSIX
-
-/* Don't bother with asctime_r and ctime_r, since these functions are
- not safe (like asctime and ctime, they can overrun their 26-byte
- output buffers when given outlandish struct tm values), and we
- don't want to encourage applications to use unsafe functions. Use
- strftime or even sprintf instead. */
-
-# undef gmtime_r
-# undef localtime_r
-
-# define gmtime_r rpl_gmtime_r
-# define localtime_r rpl_localtime_r
-
-/* See the POSIX:2001 specification
- <http://www.opengroup.org/susv3xsh/gmtime.html>. */
-struct tm *gmtime_r (time_t const * restrict, struct tm * restrict);
-
-/* See the POSIX:2001 specification
- <http://www.opengroup.org/susv3xsh/localtime.html>. */
-struct tm *localtime_r (time_t const * restrict, struct tm * restrict);
-#endif
-
-#endif
/* Convert UTC calendar time to simple time. Like mktime but assumes UTC.
- Copyright (C) 1994, 1997, 2003, 2004, 2006 Free Software
+ Copyright (C) 1994, 1997, 2003, 2004, 2006, 2007 Free Software
Foundation, Inc. This file is part of the GNU C Library.
This program is free software; you can redistribute it and/or modify
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-#ifdef _LIBC
-# include <time.h>
-#else
+#ifndef _LIBC
# include <config.h>
-# include "timegm.h"
-# include <time_r.h>
+#endif
+
+#include <time.h>
+
+#ifndef _LIBC
# undef __gmtime_r
# define __gmtime_r gmtime_r
# define __mktime_internal mktime_internal
+++ /dev/null
-/* Convert UTC calendar time to simple time. Like mktime but assumes UTC.
-
- Copyright (C) 2003, 2005 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, write to the Free Software Foundation,
- Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-
-#include <time.h>
-
-#if defined HAVE_DECL_TIMEGM && !HAVE_DECL_TIMEGM
-time_t timegm (struct tm *tm);
-#endif
#if ! defined TIMESPEC_H
# define TIMESPEC_H
-# if HAVE_SYS_TIME_H
-# include <sys/time.h>
-# endif
# include <time.h>
-# if ! HAVE_STRUCT_TIMESPEC
-/* Some systems don't define this struct, e.g., AIX 4.1, Ultrix 4.3. */
-struct timespec
-{
- time_t tv_sec;
- long int tv_nsec;
-};
-# endif
-
/* Return negative, zero, positive if A < B, A == B, A > B, respectively.
Assume the nanosecond components are in range, or close to it. */
static inline int
: a.tv_nsec - b.tv_nsec);
}
-# if ! HAVE_DECL_NANOSLEEP
-/* Don't specify a prototype here. Some systems (e.g., OSF) declare
- nanosleep with a conflicting one (const-less first parameter). */
-int nanosleep ();
-# endif
-
void gettime (struct timespec *);
int settime (struct timespec const *);
/* xnanosleep.c -- a more convenient interface to nanosleep
- Copyright (C) 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007 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
#include <time.h>
#include "intprops.h"
-#include "timespec.h"
#ifndef TIME_T_MAX
# define TIME_T_MAX TYPE_MAXIMUM (time_t)
-#serial 20
+#serial 21
dnl From Jim Meyering.
dnl Check for the nanosleep function.
ts_sleep.tv_nsec = 999999999;
alarm (1);
if (nanosleep (&ts_sleep, &ts_remaining) == -1 && errno == EINTR
+ && nanosleep
&& TYPE_MAXIMUM (time_t) - 10 < ts_remaining.tv_sec)
return 0;
return 119;
esac],
[gl_cv_func_nanosleep=cross-compiling])
])
- if test "$gl_cv_func_nanosleep" != yes; then
+ if test "$gl_cv_func_nanosleep" = yes; then
+ REPLACE_NANOSLEEP=0
+ else
+ REPLACE_NANOSLEEP=1
if test "$gl_cv_func_nanosleep" = 'no (mishandles large arguments)'; then
AC_DEFINE([HAVE_BUG_BIG_NANOSLEEP], 1,
[Define to 1 if nanosleep mishandle large arguments.])
done
fi
AC_LIBOBJ(nanosleep)
- AC_DEFINE(nanosleep, rpl_nanosleep,
- [Define to rpl_nanosleep if the replacement function should be used.])
gl_PREREQ_NANOSLEEP
fi
-# strptime.m4 serial 2
+# strptime.m4 serial 3
dnl Copyright (C) 2007 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
AC_REQUIRE([AC_C_RESTRICT])
AC_REPLACE_FUNCS(strptime)
AC_REQUIRE([gl_TM_GMTOFF])
+ if test $ac_cv_func_strptime = yes; then
+ REPLACE_STRPTIME=0
+ else
+ REPLACE_STRPTIME=1
+ fi
])
--- /dev/null
+# Configure a more-standard replacement for <time.h>.
+
+# Copyright (C) 2000, 2001, 2003, 2004, 2005, 2006, 2007 Free Software
+# Foundation, Inc.
+
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# Written by Paul Eggert and Jim Meyering.
+
+AC_DEFUN([gl_HEADER_TIME_H],
+[
+ dnl Use AC_REQUIRE here, so that the default behavior below is expanded
+ dnl once only, before all statements that occur in other macros.
+ AC_REQUIRE([gl_HEADER_TIME_H_BODY])
+])
+
+AC_DEFUN([gl_HEADER_TIME_H_BODY],
+[
+ AC_REQUIRE([AC_C_RESTRICT])
+ AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
+ gl_ABSOLUTE_HEADER([time.h])
+ ABSOLUTE_TIME_H=\"$gl_cv_absolute_time_h\"
+ AC_SUBST([ABSOLUTE_TIME_H])
+ AC_REQUIRE([gl_CHECK_TYPE_STRUCT_TIMESPEC])
+])
+
+AC_DEFUN([gl_HEADER_TIME_H_DEFAULTS],
+[
+ 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_LOCALTIME_R=GNULIB_PORTCHECK; AC_SUBST([REPLACE_LOCALTIME_R])
+ REPLACE_NANOSLEEP=GNULIB_PORTCHECK; AC_SUBST([REPLACE_NANOSLEEP])
+ REPLACE_STRPTIME=GNULIB_PORTCHECK; AC_SUBST([REPLACE_STRPTIME])
+ REPLACE_TIMEGM=GNULIB_PORTCHECK; AC_SUBST([REPLACE_TIMEGM])
+])
+
+dnl Define HAVE_STRUCT_TIMESPEC if `struct timespec' is declared
+dnl in time.h or sys/time.h.
+
+AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC],
+[
+ AC_CHECK_HEADERS_ONCE([sys/time.h])
+ AC_CACHE_CHECK([for struct timespec in <time.h>],
+ [gl_cv_sys_struct_timespec_in_time_h],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <time.h>
+ ]],
+ [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
+ [gl_cv_sys_struct_timespec_in_time_h=yes],
+ [gl_cv_sys_struct_timespec_in_time_h=no])])
+
+ TIME_H_DEFINES_STRUCT_TIMESPEC=0
+ SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=0
+ if test $gl_cv_sys_struct_timespec_in_time_h = yes; then
+ TIME_H_DEFINES_STRUCT_TIMESPEC=1
+ else
+ AC_CACHE_CHECK([for struct timespec in <sys/time.h>],
+ [gl_cv_sys_struct_timespec_in_sys_time_h],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <sys/time.h>
+ ]],
+ [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
+ [gl_cv_sys_struct_timespec_in_sys_time_h=yes],
+ [gl_cv_sys_struct_timespec_in_sys_time_h=no])])
+ if test $gl_cv_sys_struct_timespec_in_time_h = yes; then
+ SYS_TIME_H_DEFINES_STRUCT_TIMESPEC=1
+ fi
+ fi
+ AC_SUBST([TIME_H_DEFINES_STRUCT_TIMESPEC])
+ AC_SUBST([SYS_TIME_H_DEFINES_STRUCT_TIMESPEC])
+])
dnl Reentrant time functions like localtime_r.
-dnl Copyright (C) 2003, 2006 Free Software Foundation, Inc.
+dnl Copyright (C) 2003, 2006, 2007 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.
[gl_cv_time_r_posix=yes],
[gl_cv_time_r_posix=no])])
if test $gl_cv_time_r_posix = yes; then
- AC_DEFINE([HAVE_TIME_R_POSIX], 1,
- [Define to 1 if localtime_r, etc. have the type signatures that
- POSIX requires.])
+ REPLACE_LOCALTIME_R=0
else
+ REPLACE_LOCALTIME_R=1
AC_LIBOBJ([time_r])
gl_PREREQ_TIME_R
fi
-# timegm.m4 serial 3
-dnl Copyright (C) 2003 Free Software Foundation, Inc.
+# timegm.m4 serial 4
+dnl Copyright (C) 2003, 2007 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.
else
AC_REPLACE_FUNCS(timegm)
fi
- if test $ac_cv_func_timegm = no; then
+ REPLACE_TIMEGM=1
+ if test $ac_cv_func_timegm = yes; then
+ AC_CHECK_DECLS([timegm], [REPLACE_TIMEGM=0], [], [#include <time.h>])
+ fi
+ if test $REPLACE_TIMEGM = 1; then
gl_PREREQ_TIMEGM
fi
-
- AC_CHECK_DECLS([timegm], , , [#include <time.h>])
])
# Prerequisites of lib/timegm.c.
-#serial 13
+#serial 14
# Copyright (C) 2000, 2001, 2003, 2004, 2005, 2006, 2007 Free Software
# Foundation, Inc.
[
dnl Prerequisites of lib/timespec.h.
AC_REQUIRE([AC_C_INLINE])
- AC_CHECK_HEADERS_ONCE(sys/time.h)
- gl_CHECK_TYPE_STRUCT_TIMESPEC
-
- dnl Persuade glibc and Solaris <time.h> to declare nanosleep.
- AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
-
- AC_CHECK_DECLS(nanosleep, , , [#include <time.h>])
-])
-
-dnl Define HAVE_STRUCT_TIMESPEC if `struct timespec' is declared
-dnl in time.h or sys/time.h.
-
-AC_DEFUN([gl_CHECK_TYPE_STRUCT_TIMESPEC],
-[
- dnl Persuade pedantic Solaris to declare struct timespec.
- AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
-
- AC_CHECK_HEADERS_ONCE(sys/time.h)
- AC_CACHE_CHECK([for struct timespec], [gl_cv_sys_struct_timespec],
- [AC_COMPILE_IFELSE(
- [AC_LANG_PROGRAM(
- [[#if HAVE_SYS_TIME_H
- #include <sys/time.h>
- #endif
- #include <time.h>
- ]],
- [[static struct timespec x; x.tv_sec = x.tv_nsec;]])],
- [gl_cv_sys_struct_timespec=yes],
- [gl_cv_sys_struct_timespec=no])])
-
- if test $gl_cv_sys_struct_timespec = yes; then
- AC_DEFINE(HAVE_STRUCT_TIMESPEC, 1,
- [Define if struct timespec is declared in <time.h>. ])
- fi
])
m4/getdate.m4
Depends-on:
-timespec
stdbool
gettime
mktime
setenv
+time
xalloc
configure.ac:
extensions
stdbool
sys_time
-timespec
+time
configure.ac:
gl_FUNC_NANOSLEEP
Makefile.am:
Include:
-"timespec.h"
+<time.h>
Link:
$(LIB_NANOSLEEP)
m4/stat-time.m4
Depends-on:
-timespec
+time
configure.ac:
gl_STAT_TIME
Convert a string representation of time to a tm structure.
Files:
-lib/strptime.h
lib/strptime.c
m4/strptime.m4
m4/tm_gmtoff.m4
Depends-on:
+extensions
sys_time
string
strcase
stdbool
+time
time_r
configure.ac:
Makefile.am:
Include:
-"strptime.h"
+<time.h>
License:
LGPL
--- /dev/null
+Description:
+A more-standard <time.h>.
+
+Files:
+lib/time_.h
+m4/time_h.m4
+
+Depends-on:
+absolute-header
+extensions
+
+configure.ac:
+gl_HEADER_TIME_H
+
+Makefile.am:
+BUILT_SOURCES += time.h
+
+# We need the following in order to create <time.h> when the system
+# doesn't have one that works with the given compiler.
+time.h: time_.h
+ rm -f $@-t $@
+ { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */' && \
+ sed -e 's|@ABSOLUTE_TIME_H''@|$(ABSOLUTE_TIME_H)|g' \
+ -e 's|@REPLACE_LOCALTIME_R''@|$(REPLACE_LOCALTIME_R)|g' \
+ -e 's|@REPLACE_NANOSLEEP''@|$(REPLACE_NANOSLEEP)|g' \
+ -e 's|@REPLACE_STRPTIME''@|$(REPLACE_STRPTIME)|g' \
+ -e 's|@REPLACE_TIMEGM''@|$(REPLACE_TIMEGM)|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' \
+ < $(srcdir)/time_.h; \
+ } > $@-t
+ mv $@-t $@
+MOSTLYCLEANFILES += time.h time.h-t
+
+Include:
+#include <time.h>
+
+License:
+LGPL
+
+Maintainer:
+all
Files:
lib/time_r.c
-lib/time_r.h
m4/time_r.m4
Depends-on:
extensions
+time
configure.ac:
gl_TIME_R
Makefile.am:
Include:
-"time_r.h"
+<time.h>
License:
LGPL
Convert calendar time to simple time, inverse of mktime.
Files:
-lib/timegm.h
lib/timegm.c
m4/timegm.m4
Depends-on:
mktime
+time
time_r
configure.ac:
Makefile.am:
Include:
-"timegm.h"
+<time.h>
License:
LGPL
Description:
-struct timespec.
+timespec-related declarations
Files:
lib/timespec.h
m4/timespec.m4
Depends-on:
-extensions
+time
configure.ac:
gl_TIMESPEC
GPL
Maintainer:
-Jim Meyering
+Paul Eggert and Jim Meyering
Depends-on:
hash
stat-time
-timespec
+time
utimens
xalloc
intprops
Depends-on:
sys_time
-timespec
+time
configure.ac:
gl_UTIMENS
Depends-on:
nanosleep
-timespec
+time
intprops
stdbool