mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-21 13:02:25 +08:00
drv_hrt: inline hrt_elapsed_time
GCC did not do that.
This commit is contained in:
@@ -198,19 +198,6 @@ hrt_abstime ts_to_abstime(const struct timespec *ts)
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* Compute the delta between a timestamp taken in the past
|
||||
* and now.
|
||||
*
|
||||
* This function is safe to use even if the timestamp is updated
|
||||
* by an interrupt during execution.
|
||||
*/
|
||||
hrt_abstime hrt_elapsed_time(const hrt_abstime *then)
|
||||
{
|
||||
hrt_abstime delta = hrt_absolute_time() - *then;
|
||||
return delta;
|
||||
}
|
||||
|
||||
/*
|
||||
* Compute the delta between a timestamp taken in the past
|
||||
* and now.
|
||||
|
||||
@@ -98,7 +98,10 @@ __EXPORT extern void abstime_to_ts(struct timespec *ts, hrt_abstime abstime);
|
||||
*
|
||||
* This function is not interrupt save.
|
||||
*/
|
||||
__EXPORT extern hrt_abstime hrt_elapsed_time(const hrt_abstime *then);
|
||||
static inline hrt_abstime hrt_elapsed_time(const hrt_abstime *then)
|
||||
{
|
||||
return hrt_absolute_time() - *then;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute the delta between a timestamp taken in the past
|
||||
|
||||
@@ -594,17 +594,6 @@ abstime_to_ts(struct timespec *ts, hrt_abstime abstime)
|
||||
ts->tv_nsec = abstime * 1000;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare a time value with the current time.
|
||||
*/
|
||||
hrt_abstime
|
||||
hrt_elapsed_time(const hrt_abstime *then)
|
||||
{
|
||||
hrt_abstime delta = hrt_absolute_time() - *then;
|
||||
|
||||
return delta;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare a time value with the current time as atomic operation.
|
||||
*/
|
||||
|
||||
@@ -675,17 +675,6 @@ abstime_to_ts(struct timespec *ts, hrt_abstime abstime)
|
||||
ts->tv_nsec = abstime * 1000;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare a time value with the current time.
|
||||
*/
|
||||
hrt_abstime
|
||||
hrt_elapsed_time(const hrt_abstime *then)
|
||||
{
|
||||
hrt_abstime delta = hrt_absolute_time() - *then;
|
||||
|
||||
return delta;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare a time value with the current time as atomic operation.
|
||||
*/
|
||||
|
||||
@@ -715,17 +715,6 @@ abstime_to_ts(struct timespec *ts, hrt_abstime abstime)
|
||||
ts->tv_nsec = abstime * 1000;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare a time value with the current time.
|
||||
*/
|
||||
hrt_abstime
|
||||
hrt_elapsed_time(const hrt_abstime *then)
|
||||
{
|
||||
hrt_abstime delta = hrt_absolute_time() - *then;
|
||||
|
||||
return delta;
|
||||
}
|
||||
|
||||
/**
|
||||
* Compare a time value with the current time as atomic operation
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user