<div dir="ltr">Okay, so from what I could gather the time between the two gettime calls can exceed 1 sec if it is preempted by another process in between. Is my line of thought correct? </div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Apr 15, 2020 at 6:01 PM Sebastian Huber <<a href="mailto:sebastian.huber@embedded-brains.de">sebastian.huber@embedded-brains.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<p><br>
</p>
<div>On 15/04/2020 14:29, Utkarsh Rai wrote:<br>
</div>
<blockquote type="cite">
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Wed, Apr 15, 2020 at 5:35
PM Sebastian Huber <<a href="mailto:sebastian.huber@embedded-brains.de" target="_blank">sebastian.huber@embedded-brains.de</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<p>On 15/04/2020 14:02, Utkarsh Rai wrote:<br>
</p>
<blockquote type="cite">
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">> + status =
clock_gettime( CLOCK_MONOTONIC, &end_time );<br>
> + rtems_test_assert( status == 0 );<br>
> +<br>
> + rtems_test_assert(
(end_time.tv_sec-init_time.tv_sec) == 0 );<br>
<br>
Is end_time.tv_sec - init_time.tv_sec == 0 under all
circumstances?<br>
</blockquote>
<div><br>
</div>
<div>My idea was to check for a 1ns delay with a
reasonable amount of overhead, hence I checked
for end_time.tv_sec - init_time.tv_sec == 0.</div>
</blockquote>
Exists there a value of init_time for which end_time.tv_sec
!= init_time.tv_sec and still 1ns elapsed?<br>
</div>
</blockquote>
<div><br>
</div>
<div>Sorry, maybe I am confused in my concept, kidly help me
out. I want to produce a 1ns delay, so I make a call to
clock_nanosleep with flag value as 0 (to sleep for specified
time) and the delay being 1ns. I recorded the time before the
sleep call and after the sleep call. Now, I want to check if
the delay produced was actually 1ns with a reasonable
overhead, my assumption for an unreasonable overhead was that
if I specify a delay of 1ns </div>
</div>
</blockquote>
Up to here everything is fine.<br>
<blockquote type="cite">
<div class="gmail_quote">
<div>and I get a delay in seconds, it would be an error. <br>
</div>
</div>
</blockquote>
Think about this once more.<br>
</div>
</blockquote></div>