What better way to recommend the following tasks:
There is a time event (HH: MM: SS: MS).
It is necessary at this time, follow the steps.
The accuracy should not affect validity of GUI.
What better way to recommend the following tasks:
There is a time event (HH: MM: SS: MS).
It is necessary at this time, follow the steps.
The accuracy should not affect validity of GUI.
The accuracy of timers depends on the operating system. In general you will never have assurance that the call will be made exactly at the time specified. You can get very close to that value if you are using a real-time operating system but you can forget about it on regular Linux or Windows installations. Also note that Windows has a lower timer resolution that other systems (I don't know if you can tweak it).
But if I set timer in a separate thread, and will catch the system time ... for example.. every 40ms then I will be able to get accuracy +/- 40ms ?
no, because also your thread can be blocked for lets say 2 seconds, and then you don't have a accuracy of 40ms. (And beside, I think QTimer uses a separate thread by itself)((and this solution is lesser accurate than simple use a QTimer direkt.))
If you need a 100% accuracy you have to use a RTOS.
Anyway, is your application really so time sensible?
As far as I remember you can't get a better resolution that 50ms on some Windows systems, so aim for that. If your system doesn't do anything besides handling your application, it will do fine.
Bookmarks