From: Ben Gras Date: Fri, 20 May 2005 10:06:33 +0000 (+0000) Subject: made time use times() system call to get higher resolution (1/60s clock X-Git-Tag: v3.1.0~828 X-Git-Url: http://zhaoyanbai.com/repos/%22/xml/v3/status/static/gitweb.js?a=commitdiff_plain;h=cff515edd87fc3e61af81a876e24bbcb9a93ec2d;p=minix.git made time use times() system call to get higher resolution (1/60s clock ticks instead of 1s) for real time measurement. --- 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");