RTEMS: Timespec

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
Functions
Timespec
API » Classic

Timespec API. More...

## Functions
RTEMS_INLINE_ROUTINE bool | rtems_timespec_is_valid (const struct timespec *time)
| Is timespec valid.
RTEMS_INLINE_ROUTINE bool | rtems_timespec_less_than (const struct timespec *lhs, const struct timespec *rhs)
| Timespec less than operator.
RTEMS_INLINE_ROUTINE uint32_t | rtems_timespec_add_to (struct timespec *time, const struct timespec *add)
| Add to a timespec.
RTEMS_INLINE_ROUTINE uint32_t | rtems_timespec_to_ticks (const struct timespec *time)
| Convert timespec to number of ticks.
RTEMS_INLINE_ROUTINE void | rtems_timespec_from_ticks (uint32_t ticks, struct timespec *time)
| Convert ticks to timespec.
RTEMS_INLINE_ROUTINE void | rtems_timespec_subtract (const struct timespec *start, const struct timespec *end, struct timespec *result)
| Subtract two timespec.
RTEMS_INLINE_ROUTINE void | rtems_timespec_divide_by_integer (const struct timespec *time, uint32_t iterations, struct timespec *result)
| Divide timespec by integer.
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.
RTEMS_INLINE_ROUTINE void | rtems_timespec_set (struct timespec *_time, time_t _seconds, uint32_t _nanoseconds)
| Set timespec to seconds nanosecond.
RTEMS_INLINE_ROUTINE void | rtems_timespec_zero (struct timespec *_time)
| Zero timespec.
RTEMS_INLINE_ROUTINE time_t | rtems_timespec_get_seconds (struct timespec *_time)
| Get seconds portion of timespec.
RTEMS_INLINE_ROUTINE uint32_t | rtems_timespec_get_nanoseconds (struct timespec *_time)
| Get nanoseconds portion of timespec.
RTEMS_INLINE_ROUTINE bool | rtems_timespec_greater_than (const struct timespec *_lhs, const struct timespec *_rhs)
| Timespec greater than operator.
RTEMS_INLINE_ROUTINE bool | rtems_timespec_equal_to (const struct timespec *lhs, const struct timespec *rhs)
| Timespec equal to Operator.

## 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] | time | is the base time to be added to
  [in] | add | is 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] | 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

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] | time | is the total
  [in] | iterations | is the number of iterations
  [in] | result | is 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] | lhs | is the left hand side timespec
  [in] | rhs | is the right hand side timespec

Return values

  true | lhs is equal to rhs.
  false | lhs 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] | time | is the timespec format time result
  [in] | ticks | is 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] | _time | points 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] | _time | points 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] | _lhs | is the left hand side timespec
  [in] | _rhs | is 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] | time | is the timespec instance to validate.

Return values

  true | The timespec is valid.
  false | The 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] | lhs | is the left hand side timespec
  [in] | rhs | is the right hand side timespec

Return values

  true | lhs is less than rhs.
  false | lhs 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] | _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_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] | start | is the starting time
  [in] | end | is the ending time
  [in] | result | is 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] | time | is 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] | _time | points to the timespec instance to zero.