> On Jul 5, 2018, at 6:51 AM, Paul Irofti <[email protected]> wrote: > > Hi, > > POSIX requires that CLOCKS_PER_SEC be 1,000,000[0,1]. > > Any reason we have it set to 100? > > Paul > > [0] -- http://pubs.opengroup.org/onlinepubs/009695399/functions/clock.html > [1] -- http://pubs.opengroup.org/onlinepubs/009695399/basedefs/time.h.html
>From [1]: > 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. We don't claim to be strictly XSI-conforming. I mean, we have XSI options, but we're not strictly conforming. Having it set to a million also introduces issues with overflow for interfaces like clock(3), although even POSIX now acknowledges this issue and recommends other interfaces. It's 100 because hz is 100 on every platform.
