diff --git a/src/drivers/samv7/drv_hrt.c b/src/drivers/samv7/drv_hrt.c index dfafe206f4..a38e42de5a 100644 --- a/src/drivers/samv7/drv_hrt.c +++ b/src/drivers/samv7/drv_hrt.c @@ -680,6 +680,17 @@ abstime_to_ts(struct timespec *ts, hrt_abstime abstime) */ hrt_abstime hrt_elapsed_time(const volatile hrt_abstime *then) +{ + hrt_abstime delta = hrt_absolute_time() - *then; + + return delta; +} + +/** + * Compare a time value with the current time as atomic operation. + */ +hrt_abstime +hrt_elapsed_time_atomic(const volatile hrt_abstime *then) { irqstate_t flags = enter_critical_section();