[fpc-pascal]High resolution timers on linux ?

Kuba Ober kuba at mareimbrium.org
Tue Oct 2 09:29:37 CEST 2001

> > I have a unit I've used quite a lot some years ago, it was written for
> > Borland Pascal, so you will need to modify it slightly. As far as I can
> > remember, its precision was below a microsecond and didn't even reprogram
> > the timer (it did modify one setting but not the actual rate so it didn't
> > disturb other software running). The trick is that although the usual
> > timer interrupt is very rare, the timer chip itself counts rather fast.
> > All you have to do is to read this counter value and use it to form a
> > very high resolution timer.
> I think you missed the point: You can only use that kind of trick under
> DOS, he wanted a solution that works under Linux. Under Linux you would
> need a kernel module for that and that's probably beyond the scope of
> this mailing-list and is not even possible with FPC (AFAIK).

You can program i/o ports as you wish, as long as your program starts as 
root, gets proper ioperms, and then drops root privileges. Not very clean, 
and not portable outside ibm-pc compatibles, but works ;-).


More information about the fpc-pascal mailing list