diff --git a/clock.c b/clock.c index 199c0cb..cf087e8 100644 --- a/clock.c +++ b/clock.c @@ -1767,11 +1767,9 @@ enum clock_type clock_type(struct clock *c) return c->type; } -void clock_check_ts(struct clock *c, struct timespec ts) +void clock_check_ts(struct clock *c, uint64_t ts) { - if (c->sanity_check && - clockcheck_sample(c->sanity_check, - ts.tv_sec * NS_PER_SEC + ts.tv_nsec)) { + if (c->sanity_check && clockcheck_sample(c->sanity_check, ts)) { servo_reset(c->servo); } } diff --git a/clock.h b/clock.h index 94d4ad0..3fa026d 100644 --- a/clock.h +++ b/clock.h @@ -316,7 +316,7 @@ enum clock_type clock_type(struct clock *c); * @param c The clock instance. * @param ts The time stamp. */ -void clock_check_ts(struct clock *c, struct timespec ts); +void clock_check_ts(struct clock *c, uint64_t ts); /** * Obtain ratio between master's frequency and current clock frequency. diff --git a/port.c b/port.c index 25507e2..d1c95ab 100644 --- a/port.c +++ b/port.c @@ -2519,7 +2519,8 @@ enum fsm_event port_event(struct port *p, int fd_index) } if (msg_sots_valid(msg)) { ts_add(&msg->hwts.ts, -p->rx_timestamp_offset); - clock_check_ts(p->clock, msg->hwts.ts); + clock_check_ts(p->clock, + tmv_to_nanoseconds(timespec_to_tmv(msg->hwts.ts))); } if (port_ignore(p, msg)) { msg_put(msg);