if (idx >= MAX_INFOS)
error(1, 0, "%s idx too high", __FUNCTION__);
} else {
if (idx >= MAX_INFOS)
error(1, 0, "%s idx too high", __FUNCTION__);
} else {
error(1, 0, "%s error", __FUNCTION__);
}
return &msg_infos[idx];
error(1, 0, "%s error", __FUNCTION__);
}
return &msg_infos[idx];
- timespec_subtract(timeout, &last, &now);
+ if (timespec_subtract(timeout, &last, &now) /* is negative */) {
+ stats.overrun++;
+ memset(timeout, 0, sizeof(*timeout));
+ }
} else if (opt.timeout_ms != 0) {
timeout->tv_sec = opt.timeout_ms/1000;
timeout->tv_nsec = (opt.timeout_ms%1000)*1000000;
} else if (opt.timeout_ms != 0) {
timeout->tv_sec = opt.timeout_ms/1000;
timeout->tv_nsec = (opt.timeout_ms%1000)*1000000;
receive(s, &frame, &ts_kern, &ts_user);
mi = frame2info(&frame);
mi->ts_rx_final_kern = ts_kern;
receive(s, &frame, &ts_kern, &ts_user);
mi = frame2info(&frame);
mi->ts_rx_final_kern = ts_kern;
ret = send_frame(pfd[0].fd); \
if (ret != sizeof(struct can_frame)) { \
if (ret == -1 && errno == ENOBUFS && opt.period_us == 0 && !opt.oneattime) { \
ret = send_frame(pfd[0].fd); \
if (ret != sizeof(struct can_frame)) { \
if (ret == -1 && errno == ENOBUFS && opt.period_us == 0 && !opt.oneattime) { \
/* Ignore this error - pfifo_fast qeuue is full */ \
} else \
error(1, errno, "send_frame (line %d)", __LINE__); \
/* Ignore this error - pfifo_fast qeuue is full */ \
} else \
error(1, errno, "send_frame (line %d)", __LINE__); \
pthread_create(&thread, 0, measure_thread, NULL);
struct timespec next, now, diff;
pthread_create(&thread, 0, measure_thread, NULL);
struct timespec next, now, diff;
clock_gettime(CLOCK_MONOTONIC, &now);
if (timespec_subtract(&diff, &next, &now)) {
clock_gettime(CLOCK_MONOTONIC, &now);
if (timespec_subtract(&diff, &next, &now)) {