From eafdf1b819e2211d2dda91661b462640043d879e Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Mon, 15 Jan 2001 13:23:33 +0000 Subject: Reduce dependancies -- don't use sysconf() internal to libc. --- libc/misc/time/clock.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'libc/misc/time') diff --git a/libc/misc/time/clock.c b/libc/misc/time/clock.c index 4d1a17869..139d35868 100644 --- a/libc/misc/time/clock.c +++ b/libc/misc/time/clock.c @@ -16,16 +16,16 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#include #include #include +#include /* Return the time used by the program so far (user time + system time). */ clock_t clock (void) { struct tms buf; - long clk_tck = sysconf (_SC_CLK_TCK); + long clk_tck = CLK_TCK; /* We don't check for errors here. The only error the kernel returns is EFAULT if the value cannot be written to the struct we @@ -37,9 +37,7 @@ clock (void) times (&buf); return - (clk_tck <= CLOCKS_PER_SEC) - ? ((unsigned long) buf.tms_utime + buf.tms_stime) * (CLOCKS_PER_SEC - / clk_tck) - : ((unsigned long) buf.tms_utime + buf.tms_stime) / (clk_tck - / CLOCKS_PER_SEC); + (clk_tck <= CLOCKS_PER_SEC) ? + ((unsigned long) buf.tms_utime + buf.tms_stime) * (CLOCKS_PER_SEC / clk_tck) : + ((unsigned long) buf.tms_utime + buf.tms_stime) / (clk_tck / CLOCKS_PER_SEC); } -- cgit v1.2.3