[PATCH, RTEMS] Fix CLOCKS_PER_SEC

Gedare Bloom gedare@rtems.org
Tue Mar 3 19:54:00 GMT 2015


Updated patch attached that merges the two cases.

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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-rtems-fix-CLOCKS_PER_SEC.patch
Type: text/x-diff
Size: 904 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/newlib/attachments/20150303/05ea90a0/attachment.bin>


More information about the Newlib mailing list