casaroli commented on issue #3516:
URL: https://github.com/apache/nuttx/issues/3516#issuecomment-6360509660

   The POSIX.1-2024 text, for reference.
   
   
[`<time.h>`](https://pubs.opengroup.org/onlinepubs/9799919799/basedefs/time.h.html):
   
   > CLOCKS_PER_SEC
   >
   > A number used to convert the value returned by the clock() function into 
seconds.
   > The value shall be an expression with type clock_t. [XSI] The value of 
CLOCKS_PER_SEC shall be 1 million on XSI-conformant systems. However, it may be 
variable on other systems, and it should not be assumed that CLOCKS_PER_SEC is 
a compile-time constant.
   
   
[`clock()`](https://pubs.opengroup.org/onlinepubs/9799919799/functions/clock.html):
   
   > To determine the time in seconds, the value returned by clock() should be 
divided by the value of the macro CLOCKS_PER_SEC. [XSI] CLOCKS_PER_SEC is 
defined to be one million in <time.h>.
   
   
[`times()`](https://pubs.opengroup.org/onlinepubs/9799919799/functions/times.html):
   
   > Applications should use sysconf(_SC_CLK_TCK) to determine the number of 
clock ticks per second as it may vary from system to system.
   
   ISO C allows any value, but XSI requires 1000000. The system tick rate is a 
different value: `sysconf(_SC_CLK_TCK)`, the unit of `times()`. In NuttX, 
`CLK_TCK` already has this value.
   
   The Open POSIX Test Suite checks the XSI value in 
[`conformance/interfaces/clock/2-1.c`](https://github.com/linux-test-project/ltp/blob/master/testcases/open_posix_testsuite/conformance/interfaces/clock/2-1.c)
 ("Test that CLOCKS_PER_SEC == 1,000,000 in <time.h>").


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to