From owner-freebsd-bugs Tue Sep 4 11:40:12 2001 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by hub.freebsd.org (Postfix) with ESMTP id 1BB3537B40D for ; Tue, 4 Sep 2001 11:40:03 -0700 (PDT) Received: (from gnats@localhost) by freefall.freebsd.org (8.11.4/8.11.4) id f84Ie3R12253; Tue, 4 Sep 2001 11:40:03 -0700 (PDT) (envelope-from gnats) Date: Tue, 4 Sep 2001 11:40:03 -0700 (PDT) Message-Id: <200109041840.f84Ie3R12253@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Bruce Evans Subject: Re: misc/30297: CLOCKS_PER_SEC non-standard Reply-To: Bruce Evans Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR misc/30297; it has been noted by GNATS. From: Bruce Evans To: Bernd Luevelsmeyer Cc: Subject: Re: misc/30297: CLOCKS_PER_SEC non-standard Date: Wed, 5 Sep 2001 04:37:25 +1000 (EST) On Mon, 3 Sep 2001, Bernd Luevelsmeyer wrote: > >Description: > CLOCKS_PER_SEC in the #include-file is 128. > "The Single UNIX Specification" at > http://www.UNIX-systems.org/online.html however says > "CLOCKS_PER_SEC is defined to be one million in ", and > the Red Hat Linux 7.2 manpage says "POSIX requires > that CLOCKS_PER_SEC equals 1000000 independent of the actual > resolution." This is an XSI extension. In POSIX, CLOCKS_PER_SECOND can be any (arithmetic) (r)value, the same as in ISO C. Even in XSI, applications should not use this misfeature. From POSIX.1-200x draft7: 13691 XSI Although the value of CLOCKS_PER_SEC is required to be 1 million on all XSI-conformant 13692 systems, it may be variable on other systems, and it should not be assumed that 13693 CLOCKS_PER_SEC is a compile-time constant. Constants like this shouldn't be standardized. A resolution of only 1 part in a million is is potentially inadequate by a factor of about 1000 even for today's 1GHz systems. POSIX's clock_getres() is similarly broken as designed. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message