I have a Thread in Linux userspace which is woken by an interrupt 60 times per second (About 16.7ms)
After the interrupt the Thread toggles a pin which is connected to an oscilloscope. I clearly see the 16.7ms period on it.
Next the thread calls gettimeofday() to measure the time diff between two Interrupts. I only get about 13.9ms there instead of my expected 16.7ms.
I know that Linux is not an RTOS, but the oscilloscope says the timing is good. The Thread is running under the real-time scheduling policy.
struct timeval tv, tv_last;
// wait for interrupt
read(uio0_fd, &irq_count, 4);
timersub(&tv, &tv_last, &tv_sub);
", tv_sub.tv_usec, min, max);
memcpy(&tv_last, &tv, sizeof(struct timeval));