I need some advice with delaying my execution. There is a piece of algorithm that i want to run only once in every 500ms. Thereby i used "GetTickCount()" to get the ticks after running my algorithm.. now that is a short piece of algorithm and completes very fast
So i thought i would add a "delay()" or "sleep()" after running algorithm for the remainder of time within 500ms.
Then i can check the difference of ticks, if they be more than 500, i will proceed to execute my algorithm once again.
My question is: 1. Which is the best approach to this delay causing, a while loop, a Sleep(), a delay()...? Kindly suggest. 2. How best do i get precise delays.?
please help
Thanks !
I didn't find the right solution from the internet.