AC_DEFUN(AC_TIMERS, [
AC_CHECK_FUNCS(gettimeofday localtime time strftime)
case "$host_os" in
aix4.3.*)
;;
*)
AC_CHECK_FUNCS(clock_gettime);;
esac
AC_CACHE_CHECK([for clock_gettime monotonic clock], db_cv_clock_monotonic, [
AC_TRY_RUN([
main() {
struct timespec t;
return (clock_gettime(CLOCK_MONOTONIC, &t) != 0);
}], db_cv_clock_monotonic=yes, db_cv_clock_monotonic=no,
AC_TRY_LINK([
struct timespec t;
clock_gettime(CLOCK_MONOTONIC, &t);
], db_cv_clock_monotonic=yes, db_cv_clock_monotonic=no))
])
if test "$db_cv_clock_monotonic" = "yes"; then
AC_DEFINE(HAVE_CLOCK_MONOTONIC)
AH_TEMPLATE(HAVE_CLOCK_MONOTONIC,
[Define to 1 if clock_gettime supports CLOCK_MONOTONIC.])
fi
AC_CHECK_FUNCS(ctime_r)
if test "$ac_cv_func_ctime_r" = "yes"; then
AC_CACHE_CHECK([for 2 or 3 argument version of ctime_r], db_cv_ctime_r_3arg, [
AC_TRY_LINK([
ctime_r(NULL, NULL, 100);
], [db_cv_ctime_r_3arg="3-argument"], [db_cv_ctime_r_3arg="2-argument"])])
fi
if test "$db_cv_ctime_r_3arg" = "3-argument"; then
AC_DEFINE(HAVE_CTIME_R_3ARG)
AH_TEMPLATE(HAVE_CTIME_R_3ARG,
[Define to 1 if ctime_r takes a buffer length as a third argument.])
fi
])