RTEMS
5.1
|
Timespec API. More...
Functions | |
RTEMS_INLINE_ROUTINE bool | rtems_timespec_is_valid (const struct timespec *time) |
Is timespec valid. More... | |
RTEMS_INLINE_ROUTINE bool | rtems_timespec_less_than (const struct timespec *lhs, const struct timespec *rhs) |
Timespec less than operator. More... | |
RTEMS_INLINE_ROUTINE uint32_t | rtems_timespec_add_to (struct timespec *time, const struct timespec *add) |
Add to a timespec. More... | |
RTEMS_INLINE_ROUTINE uint32_t | rtems_timespec_to_ticks (const struct timespec *time) |
Convert timespec to number of ticks. More... | |
RTEMS_INLINE_ROUTINE void | rtems_timespec_from_ticks (uint32_t ticks, struct timespec *time) |
Convert ticks to timespec. More... | |
RTEMS_INLINE_ROUTINE void | rtems_timespec_subtract (const struct timespec *start, const struct timespec *end, struct timespec *result) |
Subtract two timespec. More... | |
RTEMS_INLINE_ROUTINE void | rtems_timespec_divide_by_integer (const struct timespec *time, uint32_t iterations, struct timespec *result) |
Divide timespec by integer. More... | |
RTEMS_INLINE_ROUTINE void | rtems_timespec_divide (const struct timespec *lhs, const struct timespec *rhs, uint32_t *ival_percentage, uint32_t *fval_percentage) |
Divide timespec. More... | |
RTEMS_INLINE_ROUTINE void | rtems_timespec_set (struct timespec *_time, time_t _seconds, uint32_t _nanoseconds) |
Set timespec to seconds nanosecond. More... | |
RTEMS_INLINE_ROUTINE void | rtems_timespec_zero (struct timespec *_time) |
Zero timespec. More... | |
RTEMS_INLINE_ROUTINE time_t | rtems_timespec_get_seconds (struct timespec *_time) |
Get seconds portion of timespec. More... | |
RTEMS_INLINE_ROUTINE uint32_t | rtems_timespec_get_nanoseconds (struct timespec *_time) |
Get nanoseconds portion of timespec. More... | |
RTEMS_INLINE_ROUTINE bool | rtems_timespec_greater_than (const struct timespec *_lhs, const struct timespec *_rhs) |
Timespec greater than operator. More... | |
RTEMS_INLINE_ROUTINE bool | rtems_timespec_equal_to (const struct timespec *lhs, const struct timespec *rhs) |
Timespec equal to Operator. More... | |
Timespec API.
RTEMS_INLINE_ROUTINE uint32_t rtems_timespec_add_to | ( | struct timespec * | time, |
const struct timespec * | add | ||
) |
Add to a timespec.
This routine adds two timespecs. The second argument is added to the first.
[in] | time | is the base time to be added to |
[in] | add | is the timespec to add to the first argument |
RTEMS_INLINE_ROUTINE void rtems_timespec_divide | ( | const struct timespec * | lhs, |
const struct timespec * | rhs, | ||
uint32_t * | ival_percentage, | ||
uint32_t * | fval_percentage | ||
) |
Divide timespec.
This routine divides a timespec by another timespec. The intended use is for calculating percentages to three decimal points.
[in] | lhs | is the left hand number |
[in] | rhs | is the right hand number |
[in] | ival_percentage | is the integer portion of the average |
[in] | fval_percentage | is the thousandths of percentage |
RTEMS_INLINE_ROUTINE void rtems_timespec_divide_by_integer | ( | const struct timespec * | time, |
uint32_t | iterations, | ||
struct timespec * | result | ||
) |
Divide timespec by integer.
This routine divides a timespec by an integer value. The expected use is to assist in benchmark calculations where you typically divide a duration by a number of iterations.
[in] | time | is the total |
[in] | iterations | is the number of iterations |
[in] | result | is the average time. |
RTEMS_INLINE_ROUTINE bool rtems_timespec_equal_to | ( | const struct timespec * | lhs, |
const struct timespec * | rhs | ||
) |
Timespec equal to Operator.
This method is the is equal to than operator for timespecs.
[in] | lhs | is the left hand side timespec |
[in] | rhs | is the right hand side timespec |
true | lhs is equal to rhs. |
false | lhs is not equal to rhs. |
RTEMS_INLINE_ROUTINE void rtems_timespec_from_ticks | ( | uint32_t | ticks, |
struct timespec * | time | ||
) |
Convert ticks to timespec.
This routine converts the ticks value to the corresponding timespec format time.
[in] | time | is the timespec format time result |
[in] | ticks | is the number of ticks to convert |
RTEMS_INLINE_ROUTINE uint32_t rtems_timespec_get_nanoseconds | ( | struct timespec * | _time | ) |
Get nanoseconds portion of timespec.
This method returns the nanoseconds portion of the specified timespec
[in] | _time | points to the timespec |
RTEMS_INLINE_ROUTINE time_t rtems_timespec_get_seconds | ( | struct timespec * | _time | ) |
Get seconds portion of timespec.
This method returns the seconds portion of the specified timespec
[in] | _time | points to the timespec |
RTEMS_INLINE_ROUTINE bool rtems_timespec_greater_than | ( | const struct timespec * | _lhs, |
const struct timespec * | _rhs | ||
) |
Timespec greater than operator.
This method is the greater than operator for timespecs.
[in] | _lhs | is the left hand side timespec |
[in] | _rhs | is the right hand side timespec |
true | _lhs is greater than _rhs. |
false | _lhs is not greater than _rhs. |
RTEMS_INLINE_ROUTINE bool rtems_timespec_is_valid | ( | const struct timespec * | time | ) |
Is timespec valid.
This method determines the validity of a timespec.
[in] | time | is the timespec instance to validate. |
true | The timespec is valid. |
false | The timespec is not valid. |
RTEMS_INLINE_ROUTINE bool rtems_timespec_less_than | ( | const struct timespec * | lhs, |
const struct timespec * | rhs | ||
) |
Timespec less than operator.
This method is the less than operator for timespecs.
[in] | lhs | is the left hand side timespec |
[in] | rhs | is the right hand side timespec |
true | lhs is less than rhs. |
false | lhs is not less than rhs. |
RTEMS_INLINE_ROUTINE void rtems_timespec_set | ( | struct timespec * | _time, |
time_t | _seconds, | ||
uint32_t | _nanoseconds | ||
) |
Set timespec to seconds nanosecond.
This method sets the timespec to the specified seconds and nanoseconds value.
[in] | _time | points to the timespec instance to validate. |
[in] | _seconds | is the seconds portion of the timespec |
[in] | _nanoseconds | is the nanoseconds portion of the timespec |
RTEMS_INLINE_ROUTINE void rtems_timespec_subtract | ( | const struct timespec * | start, |
const struct timespec * | end, | ||
struct timespec * | result | ||
) |
Subtract two timespec.
This routine subtracts two timespecs. result is set to end - start.
[in] | start | is the starting time |
[in] | end | is the ending time |
[in] | result | is the difference between starting and ending time. |
RTEMS_INLINE_ROUTINE uint32_t rtems_timespec_to_ticks | ( | const struct timespec * | time | ) |
Convert timespec to number of ticks.
This routine convert the time timespec to the corresponding number of clock ticks.
[in] | time | is the time to be converted |
RTEMS_INLINE_ROUTINE void rtems_timespec_zero | ( | struct timespec * | _time | ) |
Zero timespec.
This method sets the timespec to zero. value.
[in] | _time | points to the timespec instance to zero. |