> -----Original Message-----
Mr. Ramey,

        You recently wrote:

> Realizing that usleep() is not necessarily deterministic, I 
> replaced the
> usleep() call with:
> 
> delayStart = gethrtime();
>  while ((gethrtime() - delayStart) < SAMPLE_DELAY)
>       ;
> 
> What I find is that, after the call to gethrtime(), the variable
> "now" has the same values as the variable "start". resulting in
> elapsedSecs always being equal to 0.  If I replace the gethrtime()
> version of the code with usleep(), it all works again.
> 
> Is there some known interaction between clock_gettime() and 
> gethrtime()
> that I might be unaware of?

        I was going to say that it appears that the clock that
clock_gettime(CLOCK_REALTIME, &now) returns is updated by Linux rather than
RTLinux.  This would nicely explain the behavior you experienced.  The
reason for this is that the usleep yields the CPU and allows other processes
to run (Linux?), while the hard delay loop does not.  It is entirely
possible that the clock that is returned by CLOCK_REALTIME is updated by the
RTLinux scheduler rather than Linux - either way you would get the same
result.

        I said I was *going* to say that, because subsequent research has
shown:  I have no idea how all these clocks are handled in RTLinux, nor does
it appear to be documented.  Sigh.  A browse through the source code and
"documentation" shows that I can not really follow which clock
CLOCK_REALTIME is actually using, nor can I figure out how it is updated.

        Hopefully someone more authoritative will chime in with some
confirmation of my suspicion and a clear concise description of the clock
handling.

Regards,

Steve


--------------------------
Stephen D. Cohen
Engineering Manager
Xybion Sensor Positioning Systems
11528 53rd Street North
Clearwater, FL 33760
Voice: (727) 299-0150
Fax: (727) 299-0804 
[EMAIL PROTECTED]
www.xybion.com




************************************************************************
THIS EMAIL, AND ANY ATTACHMENTS, CONTAINS CONFIDENTIAL AND PRIVILEGED INFORMATION 
INTENDED FOR THE USE OF THE ADDRESSEE. IF YOU ARE NOT THE INTENDED RECIPIENT OR AN 
AUTHORIZED REPRESENTATIVE OF THE RECIPIENT, DO NOT READ OR DISTRIBUTE THE CONTENTS OF 
THIS EMAIL AND DELETE IT FROM YOUR SYSTEM. THIS EMAIL AND ALL ATTACHMENTS HAVE BEEN 
SCANNED FOR VIRUSES AND ARE BELIEVED TO BE VIRUS FREE. HOWEVER, IT IS THE RECIPIENT'S 
RESPONSIBILITY TO ENSURE THAT THEY ARE VIRUS FREE. XYBION DOES NOT ACCEPT ANY 
RESPONSIBILITY FOR ANY LOSS OR DAMAGE ARISING IN ANY WAY FROM USE OF THIS EMAIL AND 
ATTACHMENTS. XYBION ALSO DOES NOT ACCEPT RESPONSIBILITY FOR PERSONAL EMAIL OR EMAIL 
NOT ASSOCIATED WITH ITS BUSINESS PURPOSES.
************************************************************************

-- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
--
For more information on Real-Time Linux see:
http://www.rtlinux.org/

Reply via email to