< Previous by Date Date Index Next by Date >
< Previous in Thread Thread Index Next in Thread >

Re: [reSIProcate] Timers: why system time?


Hi

Here is a patch to use monotonic clock.
It is 3 modified files from reSIProcate 1.4.
Attached files have Windows (CLRF) eof-style.

Windows
=======

GetTickCount() with 16 ms inaccuracy used.
It is very simple to change it to timeGetTime() etc with 1 ms accuracy,
but it will require init/fini calls on application level and linking
with Winmm.lib 

Tested on Windows XP SP2, compiled with VS7.1

Not tested on Windows CE

Linux
=====

If monotonic clock is not available (compile time and runtime) it will
fall back to gettimeofday() 

I am not familiar with reSIProcate build system so I use workaround to
avoid linking with librt:
syscall( __NR_clock_gettime, ... )
instead of clock_gettime(...)

IMHO it may not work on other POSIX compliant platforms.

Pass only some basic tests on my Linux PC (2.6.18 kernel)

Any feedbacks appreciated.

Regards
Alexander Altshuler
Xeepe team
http://xeepe.com

Attachment: monotonic_patch.zip
Description: Binary data