Home » Community » Newbie corner » running program at different speeds
Re: running program at different speeds [message #37013 is a reply to message #37012] |
Wed, 08 August 2012 13:55   |
|
On POSIX platforms Sleep() is implemented using nanosleep function. If you look in manual for this function it says this:
man nanosleep | The suspension time may be longer than requested because the argument value is rounded up to an integer multiple of the sleep resolution or because of the scheduling of other activity by the system.
|
Very similar conditions hold AFAIK for the windows implementation.
In addition (at least on POSIX) it is possible that Sleep returns earlier then it is supposed, if it is interrupted by a signal from outside.
If you need to get more precise speed adjustments, you might want to try longer Sleep() less often (e.g. every n-th iteration of the loop).
Honza
|
|
|
Goto Forum:
Current Time: Sun Jun 08 09:55:40 CEST 2025
Total time taken to generate the page: 0.04001 seconds
|