[PATCH] change CLOCKS_PER_SEC to match POSIX:XSI
Tue Oct 11 18:32:00 GMT 2005
Joel Sherrill wrote:
> Corinna Vinschen wrote:
> On Oct 6 13:19, Bob Wilson wrote:
> The XSI extension to POSIX requires that CLOCKS_PER_SEC be defined
> to one million. The current value in newlib, except for RTEMS and
> ARM, is 1000. Since this value seems pretty arbitrary, wouldn't it
> be better to go with the POSIX value? Here is a patch to change it.
> 2005-10-06 Bob Wilson <firstname.lastname@example.org>
> * libc/include/time.h (CLOCKS_PER_SEC): Define to 1000000.
> Careful, please. This could break newly compiled applications on
> systems using the CLOCKS_PER_SEC macro internally.
> I always thought this was an arbitrary and useless macro. On RTEMS
> and many other systems, the clock tick quantum is configurable.
> Why is 1000000 suddenly right?
I'm afraid I can't answer the "why" question. I stumbled upon this
requirement a while back when I was trying to decide upon a less
arbitrary value for this macro.
Judging from various mailing list archives, the change has been
somewhat controversial, but it appears that several other prominent C
libraries have adopted it.
The default value is easily overridden, so I'm not going to push very
hard to get the default changed. I thought it was at least worth
calling to your attention.
More information about the Newlib