Skip to content

Commit

Permalink
drv_hrt: allow timedifferences across timestamp wrap again
Browse files Browse the repository at this point in the history
reverting a small part of
4a55393
  • Loading branch information
MaEtUgR committed Jul 9, 2024
1 parent 419652b commit de23401
Showing 1 changed file with 1 addition and 10 deletions.
11 changes: 1 addition & 10 deletions src/drivers/drv_hrt.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,16 +162,7 @@ static inline void abstime_to_ts(struct timespec *ts, hrt_abstime abstime)
*/
static inline hrt_abstime hrt_elapsed_time(const hrt_abstime *then)
{
hrt_abstime now = hrt_absolute_time();

// Cannot allow a negative elapsed time as this would appear
// to be a huge positive elapsed time when represented as an
// unsigned value!
if (*then > now) {
return 0;
}

return now - *then;
return hrt_absolute_time() - *then;
}

/**
Expand Down

0 comments on commit de23401

Please sign in to comment.