This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: [PATCH, RTEMS] Fix CLOCKS_PER_SEC
- From: Gedare Bloom <gedare at rtems dot org>
- To: "newlib at sourceware dot org" <newlib at sourceware dot org>
- Date: Tue, 3 Mar 2015 14:42:36 -0500
- 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>
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
From 3fec9e0779d620318e845bda532235453286cbf2 Mon Sep 17 00:00:00 2001
From: Gedare Bloom <gedare@rtems.org>
Date: Tue, 3 Mar 2015 14:41:22 -0500
Subject: [PATCH] rtems: fix CLOCKS_PER_SEC
---
newlib/libc/include/machine/time.h | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/newlib/libc/include/machine/time.h b/newlib/libc/include/machine/time.h
index 3057c81..9b44941 100644
--- a/newlib/libc/include/machine/time.h
+++ b/newlib/libc/include/machine/time.h
@@ -1,12 +1,10 @@
#ifndef _MACHTIME_H_
#define _MACHTIME_H_
-#if defined(__rtems__)
-#define _CLOCKS_PER_SEC_ sysconf(_SC_CLK_TCK)
+#if defined(__rtems__) || defined(__VISIUM__)
+#define _CLOCKS_PER_SEC_ 1000000
#elif defined(__aarch64__) || defined(__arm__) || defined(__thumb__)
#define _CLOCKS_PER_SEC_ 100
-#elif defined (__VISIUM__)
-#define _CLOCKS_PER_SEC_ 1000000
#endif
#ifdef __SPU__
--
1.9.1