To create an "active" delay within a loop, I use something like:
1 2 3
if (currentime-startime>1)
c++;
time(&startime);
And this will allow something (within a loop) to happen every real-time second.
Does anyone know how to do this with milliseconds (in such a way that the loop stays active)? Sleep(xxxx) won't work because its freezes the entire program.
I need something like: if (currentime-startime>.5)
I'm looking to have a "timer" within a loop (one that will not stop the loop) that counts down by tenths of a second. I need for the loop to keep runing so that other actions can take place while the timer is active. In the code above, this is acheived, but not by "tenths" of a second. The smallest increment of time I can figure out is 1 second.
(Oh: and I'm using Visual Studio C++)