lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



On 6 Oct 2006, at 09:10, Glenn Maynard wrote:

On Fri, Oct 06, 2006 at 08:52:43AM +0100, David Jones wrote:
I've now looked at how lposix _uses_ CLK_TCK.  It's used to
manipulate the results of the times(3) call.  Which, in OS X, is
documented as A) obsoleted and B) returning values in CLK_TCK's of a
second.  But sadly, as I've discovered, CLK_TCK isn't defined on OS X
10.4 so that makes times(3) completely useless.

That's just a documentation glitch, surely; CLK_TCK is the same thing as sysconf(_SC_CLK_TCK), other than its deprecatedness. My linux times (2)
manpage says:

NOTES
       The number of clock ticks per second can be obtained using
              sysconf(_SC_CLK_TCK);
       In POSIX-1996 the symbol CLK_TCK (defined in <time.h>) is
       mentioned as obsolescent. It is obsolete now.

A platform-specific documentation error doesn't make the function useless, especially when the function in question is defined by a standard which,
presumably, doesn't make the same error ...

Yes, digging into SUSv2 some more I found CLK_TCK, you can't find it using their search feature, you just have to know that it's in <time.h>. Maybe that's okay because it's marked as LEGACY. In other words, new code shouldn't be using it. And they say: "new applications should call sysconf() because the CLK_TCK macro may be withdrawn in a future issue". And SUSv2 came out in 1997.

So, yes, it's a bug in the OS X documentation (which they inherited from FreeBSD).


I'm a great fan of -ansi -pedantic -Wall though.

Don't forget -W, which enables several other useful warnings not
included in -Wall.

Yeah I know (although I don't use -W I have a home brew collection of extras). Gotta love that sense of humour that uses the "all" option to mean "some".

drj