[Bug 1894] missing a tick in _Timespec_To_ticks

bugzilla-daemon at rtems.org bugzilla-daemon at rtems.org
Thu Aug 11 13:03:41 UTC 2011


https://www.rtems.org/bugzilla/show_bug.cgi?id=1894

--- Comment #10 from Jie Liu <lj8175 at gmail.com> 2011-08-11 08:03:40 CDT ---
(In reply to comment #7)
> (In reply to comment #6)
> > I'm confused why you add 10000000 in the following line. I also have a hard
> > time figuring out what the expected output should be, should it be any number
> > greater than 10ms (expressed in ns)?
> > 
> >     printf("%d: sleep %d ns\n",i,
> > (tv.tv_sec-to.tv_sec)*1000000000+tv.tv_usec*1000-to.tv_nsec+10000000);
> 
> Can you verify in
> posix/src/posixtimespecabsolutetimeout.c:_POSIX_Absolute_timeout_to_ticks that
> the abstime is correct/expected, the value of &difference is > 10ms, and what
> is the value (and expected value) of ticks_out after conversion?

Thank you for your advice, I add the following patch:
Index: posixtimespecabsolutetimeout.c
===================================================================
RCS file: /usr1/CVS/rtems/cpukit/posix/src/posixtimespecabsolutetimeout.c,v
retrieving revision 1.4
diff -r1.4 posixtimespecabsolutetimeout.c
74a75,85
>   printk(" \
>           current_time tv_sec: %d\t tv_nsec: %d\t\n \
>           abstime      tv_sec: %d\t tv_nsec: %d\t\n \
>           difference   tv_sec: %d\t tv_nsec: %d\t\n \
>           ticks_out    %d \n", 
>           current_time.tv_sec, current_time.tv_nsec, 
>           abstime->tv_sec, abstime->tv_nsec, 
>           difference.tv_sec, difference.tv_nsec, 
>           *ticks_out
>   );
> 

And see the output(after modify _Timespec_To_ticks) as below:
           current_time tv_sec: 567993600     tv_nsec: 5792000    
           abstime      tv_sec: 567993600     tv_nsec: 14319000    
           difference   tv_sec: 0     tv_nsec: 8527000    
           ticks_out    9 

So the ticks_out is alright after modify _Timespec_To_ticks, if do not modify,
ticks_out will be 8.

The ticks_out seems alright, but why the test case still cannot get through? Is
there something related qemu makes this wrong?

-- 
Configure bugmail: https://www.rtems.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the bugs mailing list