Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How accurate is TTimer?

Tags:

delphi

When I set the TTimer interval to 1, does it in reality execute the code every 1 millisecond or is it like every 20 milliseconds or something?

I am asking this question because I know that the Windows API Sleep() function is not accurate, so I want to know if it is the same for TTimer.

like image 936
paul Avatar asked Mar 17 '23 05:03

paul


1 Answers

The standard VCL TTimer component is a wrapper for the Windows API timer functions SetTimer and KillTimer. TTimer simplifies the processing of the WM_TIMER messages by converting them into OnTimer events. A timer based on WM_TIMER message processing cannot provide a resolution better than 10 milliseconds.

Source: Sergworks

like image 145
GenuinePlaceholder Avatar answered Mar 23 '23 11:03

GenuinePlaceholder