[PATCH] patch for _Timespec_To_ticks

Jie Liu lj8175 at gmail.com
Mon Aug 8 14:38:57 UTC 2011


Hi,

This is found in the gcj porting, which use pthread_cond_timedwait for
the sleep().
The test case before add this patch and output can be seen:
http://code.google.com/p/rtemsgcj/source/browse/trunk/algorithm/20110808javaSleep/?r=123

And after the patch, the test case and output can be seen:
http://code.google.com/p/rtemsgcj/source/browse/trunk/algorithm/20110808javaSleep/?r=124

But there appears to be still a tick missed, could you tell me why ?

Index: cpukit/score/src/timespectoticks.c
===================================================================
RCS file: /usr1/CVS/rtems/cpukit/score/src/timespectoticks.c,v
retrieving revision 1.3
diff -r1.3 timespectoticks.c
45a46,53
>   /**
>    * We should ensure the ticks not be truncated by intenger division
>    * And ticks add 1 seems not enough..
>    */
>
>   if ( (time->tv_nsec % rtems_configuration_get_nanoseconds_per_tick()) != 0)
>     ticks ++;
>
48,49d55
<
<   return 1;

Thanks,
Jie



More information about the bugs mailing list