Hi,
I am trying to sleep in my program for a half second.
sleep(1) appears to sleep for a second and sleep(.5) appears not to sleep at all.
I am doing this wrong or is there another way to sleep for partial seconds?
thanks
Hi,
I am trying to sleep in my program for a half second.
sleep(1) appears to sleep for a second and sleep(.5) appears not to sleep at all.
I am doing this wrong or is there another way to sleep for partial seconds?
thanks
Ivan
You could try usleep(500000);
to sleep for 500000 microseconds.
But bear in mind, it's still a minimum value - the operating system might decide there are more important things to do when the time is up.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
How are you supposed to 'sleep' using a for() statement?!Originally posted by Engineer223
be cheap and use the for() statement
by using an empty for statement
aloa
cody
#include "reallife.h"
How do you know how long one for() loop lasts?
What will people say if they hear that I'm a Jesus freak?
What will people do if they find that it's true?
I don't really care if they label me a Jesus freak, there is no disguising the truth!
Jesus Freak, D.C. Talk
-gnu-ehacks
You don't
That's why it's cheap
aloa
cody
#include "reallife.h"