Re: clock(3) non-functional?
Svante Signell, le Sun 29 Jun 2014 23:11:14 +0200, a écrit :
> On Sun, 2014-06-29 at 22:56 +0200, Samuel Thibault wrote:
> > Hello,
>
> > > The following simple program gives unreliable results both on Linux and
> > > especially Hurd:
> >
> > Again, what do you mean by "unreliable"? What did you expect?
>
> I'd expected an elapsed time of 3 seconds with a sleep(3) in between
> start and stop. That's the usage in the libsamplerate code. If it is
> computer CPU time to execute the command sleep(3) the result seems
> reasonable.
sleep(3) does not consume CPU, so the value returned by clock() is not
supposed to increase much. You have to use a busy loop in order to
consume CPU.
Samuel
Reply to: