you might want to read the manpages.
The TIMER_ABSTIME flag is probably not what you want, unless you're getting seconds and nanoseconds in absolute time. In the above function, there's no indication that values you're getting _are_ correct, and the symptom you're seeing is characteristic of incorrect values.
I've got some timer code that works, and it looks like:
Code:
timeout.it_value.tv_sec = 0;
timeout.it_value.tv_nsec = 1000;
timeout.it_interval.tv_sec = timeout.it_value.tv_sec;
timeout.it_interval.tv_nsec = timeout.it_value.tv_nsec;
status = timer_create(CLOCK_REALTIME, &evp, &m_nTimerIds[nTimerId]);
sigaction(evp.sigev_signo, &sig_act, 0);
if(status < 0)
{
fprintf(stderr, "ERROR: Cannot start timer for id: %d.\n", nTimerId);
return status;
}
status = timer_settime(m_nTimerIds[nTimerId], 0, &timeout, NULL);
if(status < 0)
{
perror("settimer failed");
return -1;
}
this is relative time based, rather than absolute time based (absolute time being prone to errors such as "The date is really tuesday, but you think its monday").