From: Kees Jongenburger Date: Fri, 13 Sep 2013 09:48:40 +0000 (+0200) Subject: posix-test:fix times test X-Git-Tag: v3.3.0~791 X-Git-Url: http://zhaoyanbai.com/repos/man.nsupdate.html?a=commitdiff_plain;h=88c79fc9e9450c3c599c10b5801b5dd881befa13;p=minix.git posix-test:fix times test Applications should use sysconf(_SC_CLK_TCK) to determine the number of clock ticks per second as it may vary from system to system. --- diff --git a/test/test2.c b/test/test2.c index 11bb3a735..dd63e4d16 100644 --- a/test/test2.c +++ b/test/test2.c @@ -318,11 +318,14 @@ void test2g() time_t t1, t2; clock_t t3, t4; + long clocks_per_sec; struct tms tmsbuf; subtest = 7; errno = -7000; + clocks_per_sec = sysconf(_SC_CLK_TCK); + /* First time(). */ t1 = -1; t2 = -2; @@ -341,7 +344,7 @@ void test2g() /* Now times(). */ t4 = times(&tmsbuf); if ( t4 == (clock_t) -1) e(6); - if (t4 - t3 < CLOCKS_PER_SEC) e(7); + if (t4 - t3 < clocks_per_sec) e(7); if (tmsbuf.tms_utime < 0) e(8); if (tmsbuf.tms_stime < 0) e(9); if (tmsbuf.tms_cutime < 0) e(10);