From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 116846 invoked by alias); 7 Sep 2017 05:17:26 -0000 Mailing-List: contact newlib-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: newlib-owner@sourceware.org Received: (qmail 116835 invoked by uid 89); 7 Sep 2017 05:17:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: Yes, score=5.7 required=5.0 tests=AWL,BAYES_50,FOREIGN_BODY,RCVD_IN_DNSWL_NONE,SPF_PASS,T_FILL_THIS_FORM_SHORT autolearn=no version=3.3.2 spammy=diese, keine, mitteilung, brains X-HELO: dedi548.your-server.de Received: from dedi548.your-server.de (HELO dedi548.your-server.de) (85.10.215.148) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 07 Sep 2017 05:17:19 +0000 Received: from [88.198.220.132] (helo=sslproxy03.your-server.de) by dedi548.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.85_2) (envelope-from ) id 1dppBk-00051F-RG; Thu, 07 Sep 2017 07:17:16 +0200 Received: from [82.135.62.35] (helo=mail.embedded-brains.de) by sslproxy03.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dppBk-0002i0-F8; Thu, 07 Sep 2017 07:17:16 +0200 Received: from localhost (localhost.localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id 2AA2F2A0A9D; Thu, 7 Sep 2017 07:17:23 +0200 (CEST) Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id ZThSK719ozWE; Thu, 7 Sep 2017 07:17:21 +0200 (CEST) Received: from localhost (localhost.localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id 4B0392A1677; Thu, 7 Sep 2017 07:17:21 +0200 (CEST) Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id KVBeImJOJrTf; Thu, 7 Sep 2017 07:17:21 +0200 (CEST) Received: from [192.168.96.129] (unknown [192.168.96.129]) by mail.embedded-brains.de (Postfix) with ESMTPSA id E4A902A0A9D; Thu, 7 Sep 2017 07:17:20 +0200 (CEST) Subject: Re: [PATCH] Let RTEMS provide clock() To: Craig Howland , newlib@sourceware.org References: <20170906065845.13573-1-sebastian.huber@embedded-brains.de> <20170906084123.GD14453@calimero.vinschen.de> From: Sebastian Huber Message-ID: Date: Thu, 07 Sep 2017 05:52:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2017/txt/msg00945.txt.bz2 On 06/09/17 16:30, Craig Howland wrote: > On 09/06/2017 09:56 AM, Joel Sherrill wrote: >> >> >> On 9/6/2017 3:53 AM, Sebastian Huber wrote: >>> On 06/09/17 10:41, Corinna Vinschen wrote: >>> >>>> I just don't quite understand.=C2=A0 Is sysconf(_SC_CLK_TCK) different >>>> from CLOCKS_PER_SEC on RTEMS? >>> >>> Yes, the CLOCKS_PER_SEC is a POSIX defined constant and the >>> sysconf(_SC_CLK_TCK) returns the actual system tick frequency. Which is >>> usually 100 or 1000 ticks per second. >>> >> >> Making it more complicated, the system tick frequency is >> something that the end user can set for each application. >> We just need to make sure that the constant CLOCKS_PER_SECOND >> is appropriate for use with clock() as defined here: >> >> http://pubs.opengroup.org/onlinepubs/9699919799/functions/clock.html >> >> Sebastian.. I assume that all that matches up per POSIX, right? >> >> --joel > CLOCKS_PER_SEC is not necessarily constant on all systems.=C2=A0 It is on= ly=20 > POSIX which requires it to be fixed (at 1 million).=C2=A0 The C standard= =20 > defines it as "an expression with type clock_t that is the number per=20 > second of the value returned by the clock function."=C2=A0 (In addition,= =20 > POSIX does not require microsecond accuracy, so the _times_r() return=20 > value could simply be scaled to CLOCKS_PER_SEC if so desired as an=20 > alternative way of doing it.) This CLOCKS_PER_SEC seems to be a real mess. Its 100 or 1000000 on=20 Newlib, 128 on FreeBSD, 100 on NetBSD and OpenBSD, 1000000 on glibc.=20 XSI-conformant is 1000000: http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/time.h.html With respect to times() the document above says: "To obtain the number of clock ticks per second returned by the=20 /times/()=20 =20 function, applications should call /sysconf/(_SC_CLK_TCK)." --=20 Sebastian Huber, embedded brains GmbH Address : Dornierstr. 4, D-82178 Puchheim, Germany Phone : +49 89 189 47 41-16 Fax : +49 89 189 47 41-09 E-Mail : sebastian.huber@embedded-brains.de PGP : Public key available on request. Diese Nachricht ist keine gesch=C3=A4ftliche Mitteilung im Sinne des EHUG.