I'm trying to use posix timers and running into a problem. They are affected by system clock changes when I think they should not be.
I'm using CLOCK_REALTIME clock and setting a relative timer (not setting the TIMER_ABSTIME flag.) On kernel.org I read the following:
If the value of the CLOCK_REALTIME clock is adjusted while an absolute timer based on that clock is armed, then the expiration of the timer will be appropriately adjusted. Adjustments to the CLOCK_REALTIME clock have no effect on relative timers based on that clock.
On my system, the "no effect on relative timers" statement is proving false.
OK, no problem, I can use CLOCK_MONOTONIC instead. Except that it seems to not be supported on my build. When I try to use that, my application dies with a segfault. The core file tells me it is dying in librt.so in function mq_timedreceive().
I also considered switching (back) to using setitimer instead of posix timers, but I have to have timer_getoverrun() or equivalent.
So, I either need timers that work according to the spec, or I need a monotonic clock, and I don't know how to get either one.
The gory details:
kernel is 2.6.17.6
librt is 2.3.5
libc is 2.3.5
system is ppc_6xx
Any help greatly appreciated.
Logan Ratner | Software Engineer | Gas Chromatographs
Emerson Process Management | 5650 Brittmoore Rd | Houston | TX | 77041 | USA
T +1 713 839 9656 | F +1 713 827 3807
Logan.Ratner@Emerson.com