CLK_TCK vs. CLOCKS_PER_SEC

Moderator, John S. Quarterman std-unix at longway.TIC.COM
Tue Mar 21 02:04:13 AEST 1989


Newsgroups: comp.std.unix
From: uunet!hpfcdc.HP.COM!hp-sdd!donn (Donn Terry)


CLK_TCK is usually known as HZ (which is typically 50, 60, or 100).

CLOCKS_PER_SEC is used for clock() and is typically in microseconds.

For a while they were both the same, which would be a problem, obviously.

The committees didn't detect the problem until quite late in the cycle.
Both ANSI C and POSIX are having to change as a result.  The CLOCKS_PER_SEC
name change was easy for X3J11; the corresponding changes in POSIX will
be harder because of its status as a published standard and because it
is built on ANSI C in part.  Drafts of those changes exist, but have
not been approved in any way.

For now: sysconf() will always give the "right" answer for CLK_TCK, so
use that. 

I'm speaking only for myself in this.

Donn Terry
Chair 1003.1

Volume-Number: Volume 16, Number 20



More information about the Comp.std.unix mailing list