usleep( iTick-( passedTime-startTime ) );
AFAIR usleep is not exact! - did you
echo 1024 > /proc/sys/dev/rtc/max-user-freq ?
try sth like:
void select_sleep (int usec) {
fd_set fd;
int max_fd=0;
struct timeval tv = { 0, 0 };
tv.tv_sec = 0; tv.tv_usec = usec;
FD_ZERO(&fd);
if (remote_en) {
max_fd=remote_fd_set(&fd);
}
select(max_fd, &fd, NULL, NULL, &tv);
}