🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.std.unix
Article #1279

Re: CLK_TCK vs. CLOCKS_PER_SEC

#1279
From: Moderator, John S. Quarterman
Date: Mon, 20 Mar 1989 04:28
32 lines
2387 bytes
From: uunet!BRL.MIL!gwyn

In article <320@longway.TIC.COM> uunet!mcgrath@paris.Berkeley.EDU@ (Roland McGrath) writes:
>Can anyone tell me why the ANSI C committee changed CLK_TCK to
>CLOCKS_PER_SEC, and how this is supposed to be different than the CLK_TCK
>that 1003.1 assumes the C standard defines?

In fact they have totally different uses, and X3J11 had made a serious
mistake when we used the name "CLK_TCK" for the clock()-return conversion
factor.  CLK_TCK was the 1984 /usr/group macro for  converting values
returned by times(), not clock().  1003.1 shuffled back and forth a couple
of times between ttime_t and clock_t as the type of the struct tms members,
settling on clock_t which is defined by ANSI C.  (I think a separate type
would have been better, but we can live with this.)  Then when they saw that
X3J11 had defined CLK_TCK as the appropriate conversion from units of clock_t
to seconds, they naturally assumed it was the same as the 1984 /usr/group
usage.  However, the ANSI C clock() conversion macro was not appropriate for
use with struct tms members.  Last-minute frantic coordination among principal
members of P1003 and X3J11, including the ANSI C draft review subcommittee,
resulted in X3J11 choosing a new name for the ANSI C time-conversion macro;
we considered that a (borderline) "editorial change", since the intention of
the committee was clearly not changed and the use of "CLK_TCK" for clock()
units conversion was purely an X3J11 invention.  This means that the
inheritance of the name "CLK_TCK" from <time.h> that 1003.1 expected doesn't
happen (at least, not in the absence of _POSIX_SOURCE), but that was
considered to be an "easily fixable" matter whereas forcing the same
conversion factor for both times() and clock() would have run counter to
widespread existing practice.
	- D A Gwyn
	acting X3J11/P1003 liaison

Volume-Number: Volume 16, Number 22
Technical Details
Message-ID: <323@longway.TIC.COM>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!longway!std-unix
References: <320@longway.TIC.COM>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!longway!std-unix
From: std-unix@longway.TIC.COM (Moderator, John S. Quarterman)
Newsgroups: comp.std.unix
Subject: Re: CLK_TCK vs. CLOCKS_PER_SEC
Message-ID: <323@longway.TIC.COM>
Date: 20 Mar 89 04:28:27 GMT
References: <320@longway.TIC.COM>
Reply-To: gwyn@brl.arpa (Doug Gwyn (VLD/VMB) <gwyn>)
Organization: Ballistic Research Lab (BRL), APG, MD.
Lines: 32
Approved: jsq@longway.tic.com (Moderator, John S. Quarterman)