[PATCH, RTEMS] Fix CLOCKS_PER_SEC
Joel Sherrill
joel.sherrill@oarcorp.com
Tue Mar 3 21:37:00 GMT 2015
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
More information about the Newlib
mailing list