How would I go about sleeping the same way in C++ as I would in DM?
The command would be nice :). Thanks.
ID:276805
![]() Apr 4 2006, 8:13 pm
|
|
![]() Apr 4 2006, 8:24 pm
|
|
Take a look at this
|
And, before you go wondering why using Windows' Sleep function doesn't work for you, remember that it is measured in milliseconds, not deciseconds like it is in Byond.
|
Actually, BYOND's sleep is measured in Ticks, not deciseconds, even though, in general, 1 tick = 1 decisecond, but that varys with CPU usage. It is not a good idea to assume that it is accurate to any real time though, that could create major problems when timing is key (Very rarely).
|
Scoobert wrote:
in general, 1 tick = 1 decisecond, but that varys with CPU usage. The same can be said of Windows' Sleep function, though of course not nearly to the same degree. Under stressful situations, I have clocked the WinAPI's Sleep function to be off by a bit. I don't remember how far off though, and it probably wasn't enough to care about. But still, I used to be a stickler for precision, and so at that time I made my own sleep function which would sleep for N-5 milliseconds, and then use the performance counter to measure off the rest, hanging on an empty while loop until the exact moment came; so it was much more accurate, though no person would ever have known the difference. Yeah, I know, I used to be a silly person. |