RTEMS: Score Timestamp

| RTEMS 5.4-rc2

Loading...
Searching...
No Matches
Files | Typedefs | Functions
Score Timestamp
Internal » SuperCore

Score Timestamp. More...

## Files
file | timestamp.h
| Helpers for Manipulating Timestamps.
file | timestampimpl.h
| Helpers for Manipulating Timestamps.

## Typedefs
typedef int64_t | Timestamp_Control

## Functions
RTEMS_INLINE_ROUTINE void | _Timestamp_Set (Timestamp_Control *_time, time_t _seconds, long _nanoseconds)
| Sets timestamp to specified seconds and nanoseconds.
RTEMS_INLINE_ROUTINE void | _Timestamp_Set_to_zero (Timestamp_Control *_time)
| Sets the timestamp to zero.
RTEMS_INLINE_ROUTINE bool | _Timestamp_Less_than (const Timestamp_Control *_lhs, const Timestamp_Control *_rhs)
| Checks if the left hand side timestamp is less than the right one.
RTEMS_INLINE_ROUTINE bool | _Timestamp_Greater_than (const Timestamp_Control *_lhs, const Timestamp_Control *_rhs)
| Checks if the left hand side timestamp is greater than the right one.
RTEMS_INLINE_ROUTINE bool | _Timestamp_Equal_to (const Timestamp_Control *_lhs, const Timestamp_Control *_rhs)
| Checks if the timestamps are equal.
RTEMS_INLINE_ROUTINE void | _Timestamp_Add_to (Timestamp_Control *_time, const Timestamp_Control *_add)
| Adds two timestamps.
RTEMS_INLINE_ROUTINE void | _Timestamp_Subtract (const Timestamp_Control *_start, const Timestamp_Control *_end, Timestamp_Control *_result)
| Subtracts two timestamps.
RTEMS_INLINE_ROUTINE void | _Timestamp_Divide (const Timestamp_Control *_lhs, const Timestamp_Control *_rhs, uint32_t *_ival_percentage, uint32_t *_fval_percentage)
| Divides a timestamp by another timestamp.
RTEMS_INLINE_ROUTINE time_t | _Timestamp_Get_seconds (const Timestamp_Control *_time)
| Gets seconds portion of timestamp.
RTEMS_INLINE_ROUTINE uint32_t | _Timestamp_Get_nanoseconds (const Timestamp_Control *_time)
| Gets nanoseconds portion of timestamp.
RTEMS_INLINE_ROUTINE uint64_t | _Timestamp_Get_as_nanoseconds (const Timestamp_Control *_time)
| Gets the timestamp as nanoseconds.
RTEMS_INLINE_ROUTINE void | _Timestamp_To_timespec (const Timestamp_Control *_timestamp, struct timespec *_timespec)
| Converts timestamp to struct timespec.
RTEMS_INLINE_ROUTINE void | _Timestamp_To_timeval (const Timestamp_Control *_timestamp, struct timeval *_timeval)
| Converts timestamp to struct timeval.

## Detailed Description

Score Timestamp.

This handler encapsulates functionality related to manipulating SuperCore Timestamps. SuperCore Timestamps may be used to represent time of day, uptime, or intervals.

The key attribute of the SuperCore Timestamp handler is that it is a completely opaque handler. There can be multiple implementations of the required functionality and with a recompile, RTEMS can use any implementation. It is intended to be a simple wrapper.

This handler can be implemented as either struct timespec or unsigned64 bit numbers. The use of a wrapper class allows the the implementation of timestamps to change on a per architecture basis. This is an important option as the performance of this handler is critical.

## Typedef Documentation

## ◆ Timestamp_Control

typedef int64_t Timestamp_Control

Define the Timestamp control type.

## Function Documentation

## ◆ _Timestamp_Add_to()

RTEMS_INLINE_ROUTINE void _Timestamp_Add_to | ( | Timestamp_Control * | _time,
|  | const Timestamp_Control * | _add
| ) |  |

Adds two timestamps.

This routine adds two timestamps. The second argument is added to the first.

Parameters

  [in,out] | _time | The base time to be added to.
  | _add | points The timestamp to add to the first argument.

## ◆ _Timestamp_Divide()

RTEMS_INLINE_ROUTINE void _Timestamp_Divide | ( | const Timestamp_Control * | _lhs,
|  | const Timestamp_Control * | _rhs,
|  | uint32_t * | _ival_percentage,
|  | uint32_t * | _fval_percentage
| ) |  |

Divides a timestamp by another timestamp.

This routine divides a timestamp by another timestamp. The intended use is for calculating percentages to three decimal points.

Parameters

  | _lhs | The left hand number.
  | _rhs | The right hand number.
  [out] | _ival_percentage | The integer portion of the average.
  [out] | _fval_percentage | The thousandths of percentage.

## ◆ _Timestamp_Equal_to()

RTEMS_INLINE_ROUTINE bool _Timestamp_Equal_to | ( | const Timestamp_Control * | _lhs,
|  | const Timestamp_Control * | _rhs
| ) |  |

Checks if the timestamps are equal.

This method is the is equal to than operator for timestamps.

Parameters

  _lhs | The left hand side timestamp.
  _rhs | The right hand side timestamp.

Return values

  true | _lhs is equal to _rhs
  false | _lhs is not equal to _rhs.

## ◆ _Timestamp_Get_as_nanoseconds()

RTEMS_INLINE_ROUTINE uint64_t _Timestamp_Get_as_nanoseconds | ( | const Timestamp_Control * | _time | ) |

Gets the timestamp as nanoseconds.

This method returns the timestamp as nanoseconds.

Parameters

  _time | The timestamp.

Returns
  The time in nanoseconds.

## ◆ _Timestamp_Get_nanoseconds()

RTEMS_INLINE_ROUTINE uint32_t _Timestamp_Get_nanoseconds | ( | const Timestamp_Control * | _time | ) |

Gets nanoseconds portion of timestamp.

This method returns the nanoseconds portion of the specified timestamp.

Parameters

  _time | The timestamp.

Returns
  The nanoseconds portion of _time.

## ◆ _Timestamp_Get_seconds()

RTEMS_INLINE_ROUTINE time_t _Timestamp_Get_seconds | ( | const Timestamp_Control * | _time | ) |

Gets seconds portion of timestamp.

This method returns the seconds portion of the specified timestamp.

Parameters

  _time | The timestamp.

Returns
  The seconds portion of _time.

## ◆ _Timestamp_Greater_than()

RTEMS_INLINE_ROUTINE bool _Timestamp_Greater_than | ( | const Timestamp_Control * | _lhs,
|  | const Timestamp_Control * | _rhs
| ) |  |

Checks if the left hand side timestamp is greater than the right one.

This method is the greater than operator for timestamps.

Parameters

  _lhs | The left hand side timestamp.
  _rhs | The right hand side timestamp.

Return values

  true | _lhs is greater than the _rhs.
  false | _lhs is less or equal than _rhs.

## ◆ _Timestamp_Less_than()

RTEMS_INLINE_ROUTINE bool _Timestamp_Less_than | ( | const Timestamp_Control * | _lhs,
|  | const Timestamp_Control * | _rhs
| ) |  |

Checks if the left hand side timestamp is less than the right one.

This method is the less than operator for timestamps.

Parameters

  _lhs | The left hand side timestamp.
  _rhs | The right hand side timestamp.

Return values

  true | _lhs is less than the _rhs.
  false | _lhs is greater or equal than rhs.

## ◆ _Timestamp_Set()

RTEMS_INLINE_ROUTINE void _Timestamp_Set | ( | Timestamp_Control * | _time,
|  | time_t | _seconds,
|  | long | _nanoseconds
| ) |  |

Sets timestamp to specified seconds and nanoseconds.

This method sets the timestamp to the specified _seconds and _nanoseconds value.

Parameters

  [out] | _time | The timestamp instance to set.
  | _seconds | The seconds portion of the timestamp.
  | _nanoseconds | The nanoseconds portion of the timestamp.

## ◆ _Timestamp_Set_to_zero()

RTEMS_INLINE_ROUTINE void _Timestamp_Set_to_zero | ( | Timestamp_Control * | _time | ) |

Sets the timestamp to zero.

This method sets the timestamp to zero. value.

Parameters

  [out] | _time | The timestamp instance to zero.

## ◆ _Timestamp_Subtract()

RTEMS_INLINE_ROUTINE void _Timestamp_Subtract | ( | const Timestamp_Control * | _start,
|  | const Timestamp_Control * | _end,
|  | Timestamp_Control * | _result
| ) |  |

Subtracts two timestamps.

This routine subtracts two timestamps. result is set to end - start.

Parameters

  | _start | The starting time.
  | _end | The ending time.
  [out] | _result | Contains the difference between starting and ending time after the method call.

## ◆ _Timestamp_To_timespec()

RTEMS_INLINE_ROUTINE void _Timestamp_To_timespec | ( | const Timestamp_Control * | _timestamp,
|  | struct timespec * | _timespec
| ) |  |

Converts timestamp to struct timespec.

Parameters

  | _timestamp | The timestamp.
  [out] | _timespec | The timespec to be filled in by the method.

## ◆ _Timestamp_To_timeval()

RTEMS_INLINE_ROUTINE void _Timestamp_To_timeval | ( | const Timestamp_Control * | _timestamp,
|  | struct timeval * | _timeval
| ) |  |

Converts timestamp to struct timeval.

Parameters

  | _timestamp | The timestamp.
  [out] | _timeval | The timeval to be filled in by the method.