This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: [PATCH, RTEMS] Fix CLOCKS_PER_SEC
- From: Joel Sherrill <joel dot sherrill at oarcorp dot com>
- To: Gedare Bloom <gedare at rtems dot org>, "newlib at sourceware dot org" <newlib at sourceware dot org>
- Date: Tue, 3 Mar 2015 14:33:12 -0600
- Subject: Re: [PATCH, RTEMS] Fix CLOCKS_PER_SEC
- Authentication-results: sourceware.org; auth=none
- References: <CAC82fA0eBsShOsL5jLjZiFafb+r7+0zu4L4ZQgf1GEFKdOARVQ at mail dot gmail dot com> <20150303193053 dot GS3213 at calimero dot vinschen dot de> <CAC82fA3=CEycVtmJRgsXP_DXpOFsrT0dqNHoGa2_J4vD5sM8EA at mail dot gmail dot com>
On 3/3/2015 1:42 PM, Gedare Bloom wrote:
> Updated patch attached that merges the two cases.
Is this OK? If so, I will commit it.
Thanks.
> Gedare
>
> On Tue, Mar 3, 2015 at 2:30 PM, Corinna Vinschen <vinschen@redhat.com> wrote:
>> Hi Gedera,
>>
>> On Mar 3 11:24, Gedare Bloom wrote:
>>> RTEMS use of _SC_CLK_TCK for CLOCKS_PER_SEC is broken [1]. Attached
>>> patch makes RTEMS use the constant value of 1000000 like Linux and
>>> BSD.
>>>
>>> Gedare
>>>
>>> [1] https://devel.rtems.org/ticket/2182
>>> 2015-02-25 Gedare Bloom <gedare@rtems.org>
>>>
>>> * libc/include/machine/time.h (_CLOCKS_PER_SEC_): redefine for RTEMS.
>>> From bf650325848624a2b680a3cbe759e77616f84c9c Mon Sep 17 00:00:00 2001
>>> From: Gedare Bloom <gedare@rtems.org>
>>> Date: Wed, 25 Feb 2015 14:47:58 -0500
>>> Subject: [PATCH] rtems: fix CLOCKS_PER_SEC
>>>
>>> ---
>>> newlib/libc/include/machine/time.h | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/newlib/libc/include/machine/time.h b/newlib/libc/include/machine/time.h
>>> index 3057c81..2880e71 100644
>>> --- a/newlib/libc/include/machine/time.h
>>> +++ b/newlib/libc/include/machine/time.h
>>> @@ -2,7 +2,7 @@
>>> #define _MACHTIME_H_
>>>
>>> #if defined(__rtems__)
>>> -#define _CLOCKS_PER_SEC_ sysconf(_SC_CLK_TCK)
>>> +#define _CLOCKS_PER_SEC_ 1000000
>>> #elif defined(__aarch64__) || defined(__arm__) || defined(__thumb__)
>>> #define _CLOCKS_PER_SEC_ 100
>>> #elif defined (__VISIUM__)
>> The __VISUM__ branch already defines _CLOCKS_PER_SEC_ as 1000000.
>> Please merge the __rtems__ brach with the __VISUM__ branch.
>>
>> With that change, the patch is ok.
>>
>>
>> Thanks,
>> Corinna
>>
>> --
>> Corinna Vinschen
>> Cygwin Maintainer
>> Red Hat
--
Joel Sherrill, Ph.D. Director of Research & Development
joel.sherrill@OARcorp.com On-Line Applications Research
Ask me about RTEMS: a free RTOS Huntsville AL 35805
Support Available (256) 722-9985