]> www.ginac.de Git - cln.git/commitdiff
Retrieve the real time through gettimeofday(), not times().
authorBruno Haible <bruno@clisp.org>
Sun, 27 Oct 2019 21:58:26 +0000 (22:58 +0100)
committerBruno Haible <bruno@clisp.org>
Mon, 28 Oct 2019 00:27:06 +0000 (01:27 +0100)
configure.ac
m4/times.m4 [deleted file]
src/base/cl_base_config.h.in
src/base/random/cl_random_from.cc
src/timing/cl_t_config.h.in

index 8a81007cc875bbeff75ffdc22b29a9a54fc68e66..a9dfb26e4b78c2118abc902622f8cf48c1c8a613 100644 (file)
@@ -113,8 +113,6 @@ CL_GETTIMEOFDAY
                       dnl DEFS HAVE_GETTIMEOFDAY, GETTIMEOFDAY_DOTS, GETTIMEOFDAY_TZP_T
 ac_cv_func_ftime=no
                       dnl don't use ftime(3) even if it's available
-CL_TIMES_CLOCK
-                      dnl DEFS HAVE_TIMES_CLOCK
 CL_RUSAGE
                       dnl DEFS HAVE_SYS_RESOURCE_H, HAVE_GETRUSAGE, HAVE_SYS_TIMES_H
 CL_PERROR
diff --git a/m4/times.m4 b/m4/times.m4
deleted file mode 100644 (file)
index d0d2b0e..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-dnl -*- Autoconf -*-
-dnl Copyright (C) 1993-2006 Free Software Foundation, Inc.
-dnl This file is free software, distributed under the terms of the GNU
-dnl General Public License.  As a special exception to the GNU General
-dnl Public License, this file may be distributed as part of a program
-dnl that contains a configuration script generated by Autoconf, under
-dnl the same distribution terms as the rest of that program.
-
-dnl From Bruno Haible, Marcus Daniels, Sam Steingold.
-
-AC_PREREQ(2.57)
-
-AC_DEFUN([CL_TIMES_CLOCK],
-[AC_REQUIRE([CL_GETTIMEOFDAY])dnl
-if test $ac_cv_func_gettimeofday = no -a $ac_cv_func_ftime = no; then
-AC_CHECK_FUNC(times, , no_times=1)dnl
-if test -z "$no_times"; then
-AC_CACHE_CHECK(for times return value, cl_cv_func_times_return, [
-AC_TRY_RUN([
-#include <stdlib.h> /* needed for exit() */
-#include <sys/types.h>
-#include <time.h> /* needed for CLK_TCK */
-#ifndef CLK_TCK
-#include <sys/time.h> /* needed for CLK_TCK on SYSV PTX */
-#endif
-#include <sys/times.h>
-int main ()
-{ struct tms buffer;
-  clock_t result1;
-  clock_t result2;
-  int ticks;
-  result1 = times(&buffer);
-  if ((result1 == (clock_t)0) || (result1 == (clock_t)(-1))) exit(1);
-  sleep(1);
-  result2 = times(&buffer);
-  if ((result2 == (clock_t)0) || (result2 == (clock_t)(-1))) exit(1);
-  ticks = result2 - result1;
-  exit(!((ticks >= CLK_TCK/2) && (ticks <= 3*CLK_TCK/2)));
-}], cl_cv_func_times_return=yes, cl_cv_func_times_return=no,
-dnl When cross-compiling, don't assume anything.
-cl_cv_func_times_return="guessing no")
-])
-case "$cl_cv_func_times_return" in
-  *yes) AC_DEFINE(HAVE_TIMES_CLOCK,,[have the times() function and it returns the real time, but do not have the gettimeofday() or ftime() function]) ;;
-  *no)  ;;
-esac
-fi
-fi
-])
index f4c9b7cd7d21eb14bfd8860aa8b52365e4c5cfc4..a04f8599f89d78ab3a9ec535c8bf7e067a96dc4c 100644 (file)
 /* Define as the type of `tzp' in gettimeofday() declaration. */
 #undef GETTIMEOFDAY_TZP_T
 
-/* CL_TIMES_CLOCK */
-/* Define if you have the times() function and it returns the real time,
-   but don't have the gettimeofday() function. */
-#undef HAVE_TIMES_CLOCK
-
 
 #endif /* _CL_BASE_CONFIG_H */
 
index d187f4788b94f173e2fb412a8480ad9051d1e726..53bc305f738b63913ed2c8d5a00c009cee5be229 100644 (file)
@@ -41,24 +41,6 @@ inline uint32 get_seed (void)
 }
 }  // namespace cln
 
-#elif defined(HAVE_TIMES_CLOCK)
-
-#include <ctime>
-#ifndef CLK_TCK
-#include <sys/time.h>
-#endif
-#include <sys/times.h>
-extern "C" clock_t times (struct tms * buffer);
-
-namespace cln {
-inline uint32 get_seed (void)
-{
-       var struct tms tmsbuf;
-       var uint32 seed_lo = times(&tmsbuf);
-       return seed_lo + tmsbuf.tms_utime + tmsbuf.tms_stime;
-}
-}  // namespace cln
-
 #endif
 
 #elif defined(_WIN32) && !defined(__CYGWIN__)
index a1a0fa16b6b6abe5ed309dbd5ff216bb06116a6d..aa4acecd7195a6362a04c21ab917329db94ba293 100644 (file)
 /* Define as the type of `tzp' in gettimeofday() declaration. */
 #undef GETTIMEOFDAY_TZP_T
 
-/* CL_TIMES_CLOCK */
-/* Define if you have the times() function and it returns the real time,
-   but don't have the gettimeofday() function. */
-#undef HAVE_TIMES_CLOCK
-
 /* CL_RUSAGE */
 /* Define if you have <sys/resource.h>. */
 #undef HAVE_SYS_RESOURCE_H