Date: Fri, 13 Oct 1995 14:57:26 +0400 From: "Alexander V. Lukyanov" To: djgpp AT sun DOT soe DOT clarkson DOT edu Subject: Re: clock() unit ? >From: nicolas AT jupiter DOT ceng DOT cea DOT fr (Eric NICOLAS) >Subject: clock() unit ? >Could someone tell in what unit is the result of clock() function ?? >ANSI C tell that there should be a CLK_TCK constant which says that, but I found >somewhere in djgpp .H a #define CLK_TCK 100, and when trying that it is obvious >that this is wrong. >In fact, it seems that there are about 1 million clock() units per seconds. But >what is the real value ? >This is an important point in order to preserve compatibility between djgpp programs >and TurboC programs. I think there SHOULD be a CLK_TCK constant with the right value >in the standard .H. This is a conflict between standards ANSI C and POSIX.1 In POSIX, clock() returns clock_t type, which should be divided by result of sysconf(_SC_CLK_TCK) to get seconds. CLK_TCK declared obsolete. In ANSI C clock() returns clock_t too, but it should be divided by CLOCKS_PER_SEC.