You can improve the accuracy under windows using so-called multimedia 
timer api and timeGetTime() function (using your own loop), under Linux 
clock_gettime(CLOCK_MONOTONIC, ...) function seems to be the most 
precise one, but the accuracy is NOT GUARANTEED on non real-time OSes, 
mostly due to the sheduler. You probably can improve the situation by 
setting shorter the sheduling period but it will still be dependent on 
the load, number of processes running, their priorities (priority of 
your program) etc. If you do not mind that occasionally your timer will 
get some miss-hit, you can use above functions and/or improve the 
"statistical" accuracy by keeping the system under low load, increasing 
priority of your process, shortening the period of the OS sheduler. But 
if your application is critical and you can not afford occasional 
miss-hit, there is probably no other solution than the use of real-time 
OS and its RT api. There exist RT patches for linux or you can use QNX 
or other RTOS but I have no experience with them...

Roman




Marc R.J. Brevoort wrote:
> On Thu, 24 May 2007, matthiasm wrote:
> 
>>> How accurate are add_timeout/repeat_timeout? I only see documentation
>>> about repeat_timeout having a 'fair degree of accuracy', how
>>> accurate is
>>> that?
>>
>> On MSWin, you can probably count on 1/100sec, maybe better.
> 
> Hm... In this case I'm running Linux 2.6.20. I'll be needing 1/1000 or 
> better accuracy. Any suggestions on this?
> 
> Best,
> Marc
> 
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to