RTEMS  5.0.0
Functions
Timespec

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...
 

Detailed Description

Timespec API.

Function Documentation

◆ rtems_timespec_add_to()

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.

Parameters
[in]timeis the base time to be added to
[in]addis the timespec to add to the first argument
Returns
This method returns the number of seconds time increased by.

◆ rtems_timespec_divide()

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.

Parameters
[in]lhsis the left hand number
[in]rhsis the right hand number
[in]ival_percentageis the integer portion of the average
[in]fval_percentageis the thousandths of percentage
Returns
This method fills in result.

◆ rtems_timespec_divide_by_integer()

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.

Parameters
[in]timeis the total
[in]iterationsis the number of iterations
[in]resultis the average time.
Returns
This method fills in result.

◆ rtems_timespec_equal_to()

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.

Parameters
[in]lhsis the left hand side timespec
[in]rhsis the right hand side timespec
Return values
truelhs is equal to rhs.
falselhs is not equal to rhs.

◆ rtems_timespec_from_ticks()

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.

Parameters
[in]timeis the timespec format time result
[in]ticksis the number of ticks to convert

◆ rtems_timespec_get_nanoseconds()

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

Parameters
[in]_timepoints to the timespec
Returns
The nanoseconds portion of _time.

◆ rtems_timespec_get_seconds()

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

Parameters
[in]_timepoints to the timespec
Returns
The seconds portion of _time.

◆ rtems_timespec_greater_than()

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.

Parameters
[in]_lhsis the left hand side timespec
[in]_rhsis the right hand side timespec
Return values
true_lhs is greater than _rhs.
false_lhs is not greater than _rhs.

◆ rtems_timespec_is_valid()

RTEMS_INLINE_ROUTINE bool rtems_timespec_is_valid ( const struct timespec *  time)

Is timespec valid.

This method determines the validity of a timespec.

Parameters
[in]timeis the timespec instance to validate.
Return values
trueThe timespec is valid.
falseThe timespec is not valid.

◆ rtems_timespec_less_than()

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.

Parameters
[in]lhsis the left hand side timespec
[in]rhsis the right hand side timespec
Return values
truelhs is less than rhs.
falselhs is not less than rhs.

◆ rtems_timespec_set()

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.

Parameters
[in]_timepoints to the timespec instance to validate.
[in]_secondsis the seconds portion of the timespec
[in]_nanosecondsis the nanoseconds portion of the timespec

◆ rtems_timespec_subtract()

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.

Parameters
[in]startis the starting time
[in]endis the ending time
[in]resultis the difference between starting and ending time.
Returns
This method fills in result.

◆ rtems_timespec_to_ticks()

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.

Parameters
[in]timeis the time to be converted
Returns
This method returns the number of ticks computed.

◆ rtems_timespec_zero()

RTEMS_INLINE_ROUTINE void rtems_timespec_zero ( struct timespec *  _time)

Zero timespec.

This method sets the timespec to zero. value.

Parameters
[in]_timepoints to the timespec instance to zero.