Home > Software engineering >  VB TIMER control
VB TIMER control

Time:11-15

Why not accurate VB TIMER control, feel bad a lot, have a precise TIMER control

CodePudding user response:

Because Windows the timing precision of the minimum is 55 ms, higher precision, need to use GetTickCount
https://blog.csdn.net/linjcai/article/details/81206143

CodePudding user response:

If your so-called accurate?

Timer is twice the time interval of the timer event you basic controllable, but spend time inside the timer, so, if you think you set a timer time everything is all right, then the timer event handling time cumulative error will be more and more big,
For example, your timer once every 10 seconds, trigger 360 times, must be more than an hour,
If you want to code as far as possible to maintain a proper accuracy, want oneself to detect system time,
Or just that case, you should time for an hour and then you can first according to the current system time to determine a target trigger time, and to bring the target time written to the module or static variables, the timer can be defined as once every 1 second triggered, check whether the system time to achieve every time the timer events, if you don't reach out, to keep your business logic, and in this way, a trigger in childhood, error within one second, if you set to 500 milliseconds to trigger a, then error to around half a second, the more you only 55 milliseconds the candy, but can actually about 100 milliseconds error has almost is the limit,

CodePudding user response:

The timer method can

CodePudding user response:

Precisely what level
  • Related