[fpc-pascal] Timer in X11

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Wed Dec 21 18:00:02 CET 2011


On Wed, Dec 21, 2011 at 5:46 PM, Henry Vermaak <henry.vermaak at gmail.com> wrote:
> You're still "guessing" a timer interval of 10ms to add to the timer if the
> select() doesn't time out.  So your error can be as much as 990ms per
> iteration of the loop.  So much for precision then.

select() doesn't seam to return how much time has passed, so how do
you expect me to know the value when the only thing FPC offers for
time counting is Now() and each UNIX goes a wildly different way about
this?

I tried to implement GetTickCount as a first step to at least basic
time counting support in FPC outside Now, but it was quite hard and I
don't care about timer precision that much. If you need a precise
TTimer in X11, maybe you could try to implement GetTickCount and
GetMillisecondCount. I'd merge the implementation to lazutils, which
already has a GetTickCount waiting for a proper UNIX implementation
and then I could use it to implement a precise TTimer support in
LCL-CustomDrawn-X11.

If not, then it will stay like it is now until someone sends a patch
to improve it.

-- 
Felipe Monteiro de Carvalho



More information about the fpc-pascal mailing list