Reputation: 1357
I was wondering if I could somehow get some guidance on using QueryPerformanceCounter/Frequency on performing a task at every interval in VB.NET. Let's say for example every 6 micro-second.
I was thinking maybe find the time now and do a mod on 6us, but there would lead to precision issues?
Thanks everyone.
Upvotes: 1
Views: 1027
Reputation: 5994
You could create a "timer-class" that stores the previous time and interval. Then create a method like Update(). In that method you check the current time of something like a stopwatch and compare it with the previous time and the interval. If you are to early just sleep the rest of the time. Thats princip of games are working.
Upvotes: 1