Page 1 of 1

Sleep issues

Posted: 04 February 2008, 20:57 PM
by pjc30943
Anyone else experience problems with calling sleep with longer time lengths?

For example, sleep 500.0 will cause a delay much shorter than 500s.

Is there an upper limit?

Re: Sleep issues

Posted: 04 February 2008, 21:28 PM
by mikep
pjc30943 wrote:For example, sleep 500.0 will cause a delay much shorter than 500s.

Is there an upper limit?
Yes. If you look at sleep() it takes an unsigned integer - 16 bits. Each tick is 1/512 of a second. Therefore the maximum sleep time is 65536/512 = 128 seconds.

Re: Sleep issues

Posted: 04 February 2008, 21:51 PM
by pjc30943
mikep wrote: Yes. If you look at sleep() it takes an unsigned integer - 16 bits. Each tick is 1/512 of a second. Therefore the maximum sleep time is 65536/512 = 128 seconds.
Ah. Of course... Thank you.