[fpc-pascal] Timers in FPC

Graeme Geldenhuys graemeg.lists at gmail.com
Thu May 31 15:36:56 CEST 2007


> > I guess I'm a bit late in asking, seeing that I already implemented by
> > own thread based timer. I works 100% for what I need. I just wondered
> > if there was something like that built into FPC that I missed.  I
> > would like to compare the implementations, or share mine if FPC
> > doesn't have one.
>
> You're welcome to share yours.
>
> Michael.


Hopefully somebody could find this useful or possibly it could find
its way into FPC and be the beginnings of a basic timer in FPC.  Why
must everybody always reinvent the wheel.  :-)

See attached file: threadtimer.pas

Usage:
-----------

  FTimer := TFPTimer.Create(nil);
  FTimer.OnTimer      := @FTimerTimer;
  FTimer.Interval     := 500;  // in milliseconds
  FTimer.Enabled      := False;

You can then call functions like:
FTimer.On;
FTimer.Off;
FTimer.Enabled := False;


-- 
Graeme Geldenhuys

General error, hit any user to continue.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: threadtimer.pas
Type: text/x-pascal
Size: 2826 bytes
Desc: not available
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20070531/4903e563/attachment.pas>


More information about the fpc-pascal mailing list