From 8a74f7f502ee24df5bbaa73f7e1c52a28ef4ce6a Mon Sep 17 00:00:00 2001 From: Kevin Ryde Date: Mon, 6 Sep 2004 01:29:04 +0000 Subject: [PATCH] (SCM_TIME_UNITS_PER_SECOND): Use sysconf(_SC_CLK_TCK) when available. This also gets around CLK_TCK being absent when _GNU_SOURCE and _POSIX_C_SOURCE are defined in stime.c. --- libguile/stime.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/libguile/stime.h b/libguile/stime.h index 19f1ffb50..87d89f47e 100644 --- a/libguile/stime.h +++ b/libguile/stime.h @@ -24,9 +24,23 @@ #include "libguile/__scm.h" +#include /* for sysconf */ + -/* This should be figured out by autoconf. */ +/* This should be figured out by autoconf. + + sysconf(_SC_CLK_TCK) is best, since it's the actual running kernel, not + some compile-time CLK_TCK. On glibc 2.3.2 CLK_TCK (when defined) is in + fact sysconf(_SC_CLK_TCK) anyway. + + CLK_TCK is obsolete in POSIX. In glibc 2.3.2 it's defined by default, + but if you define _GNU_SOURCE or _POSIX_C_SOURCE to get other features + then it goes away. */ + +#if ! defined(SCM_TIME_UNITS_PER_SECOND) && defined(_SC_CLK_TCK) +# define SCM_TIME_UNITS_PER_SECOND ((int) sysconf (_SC_CLK_TCK)) +#endif #if ! defined(SCM_TIME_UNITS_PER_SECOND) && defined(CLK_TCK) # define SCM_TIME_UNITS_PER_SECOND ((int) CLK_TCK) #endif