[fpc-pascal] Timer in X11

Henry Vermaak henry.vermaak at gmail.com
Wed Dec 21 18:24:30 CET 2011


On 21/12/11 17:00, Felipe Monteiro de Carvalho wrote:
> 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

select() on linux will actually modify the timeout (fpc overloads 
select(), but presumably this will still happen when you use ptimeval 
for the timeout).  You shouldn't rely on this, though, read the man page 
for more info.  This is what Mark was trying to say in his reply to your 
original message.

> 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've offered a solution in my reply to Martin Schreiber, but fpc doesn't 
offer functions for posix timers.  Perhaps you can check if Marco is in 
a good mood?  Either way you could test it first by knocking up a test in c.

Perhaps it's better to implement a thread based timer?

Henry



More information about the fpc-pascal mailing list