[Bug 1894] missing a tick in _Timespec_To_ticks
bugzilla-daemon at rtems.org
bugzilla-daemon at rtems.org
Tue Aug 9 17:50:40 UTC 2011
https://www.rtems.org/bugzilla/show_bug.cgi?id=1894
--- Comment #9 from Gedare <giddyup44 at yahoo.com> 2011-08-09 12:50:39 CDT ---
(In reply to comment #8)
> (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);
>
> Yes, the output should be greater than 10ms.
> I use "to" to save the time got by the first gettimeofday, and "tv" to save the
> time got by the second gettimeofday. And "to" also used in
> pthread_cond_timedwait after add 10,000,000ns(10ms).
>
> So, the time diff between two gettimeofday is "tv - (to - 10ms)" , is "tv - to
> +10ms ", is "tv - to + 10,000,000ns"
Oh I see. You could also just not add the 10ms and check if the result is >= 0,
right? It would be more clear I think. Anyways, double-check the values as I
suggested before. I suspect the posix conversion or use of absolute time is
causing an issue here.
--
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