简体   繁体   中英

Using QueryPerformanceCounter at Intervals in VB.NET

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM