From cff515edd87fc3e61af81a876e24bbcb9a93ec2d Mon Sep 17 00:00:00 2001 From: Ben Gras Date: Fri, 20 May 2005 10:06:33 +0000 Subject: [PATCH] made time use times() system call to get higher resolution (1/60s clock ticks instead of 1s) for real time measurement. --- commands/simple/time.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/commands/simple/time.c b/commands/simple/time.c index d01ce0383..49d8e2e22 100755 --- a/commands/simple/time.c +++ b/commands/simple/time.c @@ -39,7 +39,8 @@ char *argv[]; #if _VMD_EXT struct timeval start_time, end_time; #else - time_t start_time, end_time; + struct tms dummy; + int start_time, end_time; #endif clock_t real_time; @@ -52,7 +53,7 @@ char *argv[]; #if _VMD_EXT (void) sysutime(UTIME_TIMEOFDAY, &start_time); #else - (void) time(&start_time); + start_time = times(&dummy); #endif /* Fork off child. */ @@ -74,8 +75,8 @@ char *argv[]; real_time = (end_time.tv_sec - start_time.tv_sec) * CLOCKS_PER_SEC + (end_time.tv_usec - start_time.tv_usec) * CLOCKS_PER_SEC / 1000000; #else - (void) time(&end_time); - real_time = (end_time - start_time) * CLOCKS_PER_SEC; + end_time = times(&dummy); + real_time = (end_time - start_time); #endif if ((status & 0377) != 0) std_err("Command terminated abnormally.\n"); -- 2.44.0