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
Printable View
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
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.
be cheap and use the for() statement:rolleyes:
How are you supposed to 'sleep' using a for() statement?!Quote:
Originally posted by Engineer223
be cheap and use the for() statement:rolleyes:
by using an empty for statement :)
aloa
cody
How do you know how long one for() loop lasts?
You don't :)
That's why it's cheap ;)
aloa
cody
Or include the <time.h>
Do you have one?