+2005-11-10 Paul Eggert <eggert@cs.ucla.edu>
+
+ * modules/gethrxtime (Depends-on): Add gettime.
+
2005-11-04 Bruno Haible <bruno@clisp.org>
* gnulib-tool: Implement --update mode.
+2005-11-10 Paul Eggert <eggert@cs.ucla.edu>
+
+ * gethrxtime.c: Include "timespec.h" rather than the sys/time / time
+ business.
+ (gethrxtime) [! (HAVE_NANOUPTIME
+ || (defined CLOCK_MONOTONIC && HAVE_CLOCK_GETTIME)
+ || HAVE_MICROUPTIME)]: Fall back on gettime rather than rolling
+ our own approximation.
+
2005-11-10 Simon Josefsson <jas@extundo.com>
* readline.c: Remove EOL.
#include "gethrxtime.h"
-#include <sys/types.h>
-#if TIME_WITH_SYS_TIME
-# include <sys/time.h>
-# include <time.h>
-#else
-# if HAVE_SYS_TIME_H
-# include <sys/time.h>
-# else
-# include <time.h>
-# endif
-#endif
+#include "timespec.h"
-/* Get the time of a high-resolution clock, preferably one that is not
- subject to resetting or drifting. */
+/* Get the current time, as a count of the number of nanoseconds since
+ an arbitrary epoch (e.g., the system boot time). Prefer a
+ high-resolution clock that is not subject to resetting or
+ drifting. */
xtime_t
gethrxtime (void)
return xtime_make (tv.tv_sec, 1000 * tv.tv_usec);
}
+# else
/* No monotonically increasing clocks are available; fall back on a
clock that might jump backwards, since it's the best we can do. */
-# elif HAVE_GETTIMEOFDAY && XTIME_PRECISION != 1
{
- struct timeval tv;
- gettimeofday (&tv, NULL);
- return xtime_make (tv.tv_sec, 1000 * tv.tv_usec);
+ struct timespec ts;
+ gettime (&ts);
+ return xtime_make (ts.tv_sec, ts.tv_nsec);
}
-# else
- return xtime_make (time (NULL), 0);
# endif
#endif
}
# include "xtime.h"
/* Get the current time, as a count of the number of nanoseconds since
- an arbitrary epoch (e.g., the system boot time). This clock can't
- be set, is always increasing, and is nearly linear. */
+ an arbitrary epoch (e.g., the system boot time). Prefer a
+ high-resolution clock that is not subject to resetting or
+ drifting. */
# if HAVE_ARITHMETIC_HRTIME_T && HAVE_DECL_GETHRTIME
# include <time.h>
+2005-11-10 Paul Eggert <eggert@cs.ucla.edu>
+
+ * gethrxtime.m4 (gl_PREREQ_GETHRXTIME): Don't require AC_HEADER_TIME
+ or gettimeofday; no longer needed.
+
2005-10-30 Paul Eggert <eggert@cs.ucla.edu>
* chdir-long.m4 (gl_FUNC_CHDIR_LONG): Revamp wording and local
-# gethrxtime.m4 serial 2
+# gethrxtime.m4 serial 3
dnl Copyright (C) 2005 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
# Prerequisites of lib/gethrxtime.c.
AC_DEFUN([gl_PREREQ_GETHRXTIME],
[
- AC_REQUIRE([AC_HEADER_TIME])
AC_REQUIRE([gl_CLOCK_TIME])
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
- AC_CHECK_FUNCS_ONCE(gettimeofday microuptime nanouptime)
+ AC_CHECK_FUNCS_ONCE(microuptime nanouptime)
if test $ac_cv_func_nanouptime != yes; then
LIB_GETHRXTIME=
m4/longlong.m4
Depends-on:
+gettime
extensions
configure.ac: