[fpc-pascal]High resolution timers on linux ?

Marco van de Voort marcov at stack.nl
Tue Aug 28 10:19:23 CEST 2001


> On Mon, 27 Aug 2001, Kenneth Due wrote:
> 
> > Hello list
> > 
> > I need some way to determine when 1/10000 sec has passed
> > 
> > I suppose it can be done with the timerchip in the PC - but how ?
> > 
> > anyone ......
> > 
> 
> man usleep
> 
> usleep(X) suspends the execution of calling process for X microseconds
> (10^-6 sec). The accuracy may not be (== is not) 100% due to the
> multitasking nature of UNIX-type operating systems.
> 
> There are also setitimer() and getitimer()-functions that can be used
> to get a callback-type timed action.

nanosleep in the Unix/Linux unit works for both Linux and FreeBSD.

To properly work, it needs a machine with the rdtsc instruction (IIRC later
Intel 486's and all but the old pentiums)




More information about the fpc-pascal mailing list