PDA

View Full Version : sleep



ivandn
10-28-2001, 12:01 PM
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

Salem
10-28-2001, 01:38 PM
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.

Yoshi
11-02-2001, 11:52 PM
be cheap and use the for() statement:rolleyes:

Unregistered
12-10-2001, 01:40 PM
Originally posted by Engineer223
be cheap and use the for() statement:rolleyes:
How are you supposed to 'sleep' using a for() statement?!

cody
12-11-2001, 03:00 AM
by using an empty for statement :)

aloa
cody

gnu-ehacks
12-12-2001, 09:07 PM
How do you know how long one for() loop lasts?

cody
12-13-2001, 03:06 AM
You don't :)
That's why it's cheap ;)

aloa
cody

Yoshi
12-13-2001, 11:20 PM
Or include the <time.h>
Do you have one?