2010/8/12 Wolfgang Grandegger <[email protected]>:
> On 08/12/2010 11:39 AM, prakash srinivasan wrote:

>>
>> start=rt_timer_read();
>>
>> for()
>>
>> {}
>>
>> end=rt_timer_read();
>>
>> printf(TOTAL LOOP TIMING=%ld us\n", 
>> (long)((rt_timer_ticks2ns(end-start))/1000);
>
> What does:
>
>  printf(TOTAL LOOP TIMING=%lld us\n", rt_timer_ticks2ns(end-start)/1000);

I was trying to check the exact type of
 RTIME (return type of rt_timer_read())
and
SRTIME (expectted argument type and return type of rt_timer_ticks2ns)
and
RTIME unsigned long long

so theoretically you would need the "%lld" (long long) format for
rt_timer_ticks2ns returned value.

whereas you would need "%llu" for rt_timer_read() value.

If you try to print unsigned value with a signed format you'll get
signed "print out" interpretation of the unsigned value,
as you said:
"Early I gave (long)(start). The output was negative."

May be it would be worth having some RTIME_FORMAT
and STRIME_FORMAT macros in order to avoid that?
-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org

_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Reply via email to