Relative time durations and absolute time points.
More...
|
typedef opaque_type | embb_duration_t |
| Opaque type representing a relative time duration. More...
|
|
const embb_duration_t * | embb_duration_max () |
| Returns duration with maximum ticks representable by implementation. More...
|
|
const embb_duration_t * | embb_duration_min () |
| Returns duration with minimum ticks representable by implementation. More...
|
|
const embb_duration_t * | embb_duration_zero () |
| Returns duration of length zero. More...
|
|
int | embb_duration_set_nanoseconds (embb_duration_t *duration, unsigned long long nanoseconds) |
| Set duration from nanosecond ticks. More...
|
|
int | embb_duration_set_microseconds (embb_duration_t *duration, unsigned long long microseconds) |
| Sets duration from microsecond ticks. More...
|
|
int | embb_duration_set_milliseconds (embb_duration_t *duration, unsigned long long milliseconds) |
| Sets duration from millisecond ticks. More...
|
|
int | embb_duration_set_seconds (embb_duration_t *duration, unsigned long long seconds) |
| Sets duration from second ticks. More...
|
|
int | embb_duration_add (embb_duration_t *lhs, const embb_duration_t *rhs) |
| Adds two durations. More...
|
|
int | embb_duration_as_nanoseconds (const embb_duration_t *duration, unsigned long long *nanoseconds) |
| Converts duration to nanosecond ticks. More...
|
|
int | embb_duration_as_microseconds (const embb_duration_t *duration, unsigned long long *microseconds) |
| Converts duration to microsecond ticks. More...
|
|
int | embb_duration_as_milliseconds (const embb_duration_t *duration, unsigned long long *milliseconds) |
| Converts duration to millisecond ticks. More...
|
|
int | embb_duration_as_seconds (const embb_duration_t *duration, unsigned long long *seconds) |
| Converts duration to second ticks. More...
|
|
int | embb_duration_compare (const embb_duration_t *lhs, const embb_duration_t *rhs) |
| Compares two durations. More...
|
|
#define | EMBB_DURATION_INIT |
| Macro for initializing a duration with zero length at definition. More...
|
|
Relative time durations and absolute time points.
#define EMBB_DURATION_INIT |
Macro for initializing a duration with zero length at definition.
Opaque type representing a relative time duration.
Opaque type representing an absolute time point.
Returns duration with maximum ticks representable by implementation.
- Returns
- Pointer to duration with maximum value
- Concurrency
- Not thread-safe
- See also
- embb_duration_min()
Returns duration with minimum ticks representable by implementation.
- Returns
- Pointer to duration with minimum value
- Concurrency
- Not thread-safe
- See also
- embb_duration_max()
Returns duration of length zero.
- Returns
- Pointer to duration of length zero
- Concurrency
- Not thread-safe
int embb_duration_set_nanoseconds |
( |
embb_duration_t * |
duration, |
|
|
unsigned long long |
nanoseconds |
|
) |
| |
Set duration from nanosecond ticks.
- Returns
- EMBB_SUCCESS
EMBB_UNDERFLOW if given nanosecond interval is too small to be represented by implementation
EMBB_OVERFLOW if given nanosecond interval is too large to be represented by implementation
- Concurrency
- Not thread-safe
- Parameters
-
[out] | duration | Pointer to duration |
[in] | nanoseconds | Nanosecond ticks |
int embb_duration_set_microseconds |
( |
embb_duration_t * |
duration, |
|
|
unsigned long long |
microseconds |
|
) |
| |
Sets duration from microsecond ticks.
- Returns
- EMBB_SUCCESS
EMBB_UNDERFLOW if given microsecond interval is too small to be represented by implementation
EMBB_OVERFLOW if given microsecond interval is too large to be represented by implementation
- Concurrency
- Not thread-safe
- Parameters
-
[out] | duration | Pointer to duration |
[in] | microseconds | Microsecond ticks |
int embb_duration_set_milliseconds |
( |
embb_duration_t * |
duration, |
|
|
unsigned long long |
milliseconds |
|
) |
| |
Sets duration from millisecond ticks.
- Returns
- EMBB_SUCCESS
EMBB_UNDERFLOW if given millisecond interval is too small to be represented by implementation
EMBB_OVERFLOW if given millisecond interval is too large to be represented by implementation
- Concurrency
- Not thread-safe
- Parameters
-
[out] | duration | Pointer to duration |
[in] | milliseconds | Millisecond ticks |
int embb_duration_set_seconds |
( |
embb_duration_t * |
duration, |
|
|
unsigned long long |
seconds |
|
) |
| |
Sets duration from second ticks.
- Returns
- EMBB_SUCCESS
EMBB_UNDERFLOW if given second interval is too small to be represented by implementation
EMBB_OVERFLOW if given second interval is too large to be represented by implementation
- Concurrency
- Not thread-safe
- Parameters
-
[out] | duration | Pointer to duration |
[in] | seconds | Second ticks |
Adds two durations.
Computest the sum of rhs
and lhs
and stores the result in lhs
.
- Returns
- EMBB_SUCCESS
EMBB_OVERFLOW if sum is greater than embb_duration_max()
- Concurrency
- Not thread-safe
- Parameters
-
[in,out] | lhs | Left-hand side operand, overwritten by result of addition |
[in] | rhs | Right-hand side operand of addition |
int embb_duration_as_nanoseconds |
( |
const embb_duration_t * |
duration, |
|
|
unsigned long long * |
nanoseconds |
|
) |
| |
Converts duration to nanosecond ticks.
- Returns
- EMBB_SUCCESS
EMBB_UNDERFLOW if duration contains fractions less than a nanosecond
EMBB_OVERFLOW if duration is not representable by tick type
- Concurrency
- Not thread-safe
- Parameters
-
[in] | duration | Pointer to duration |
[out] | nanoseconds | Pointer to nanosecond ticks of duration |
int embb_duration_as_microseconds |
( |
const embb_duration_t * |
duration, |
|
|
unsigned long long * |
microseconds |
|
) |
| |
Converts duration to microsecond ticks.
- Returns
- EMBB_SUCCESS
EMBB_UNDERFLOW if duration contains fractions less than a microsecond
EMBB_OVERFLOW if duration is not representable by tick type
- Concurrency
- Not thread-safe
- Parameters
-
[in] | duration | Pointer to duration |
[out] | microseconds | Pointer to microsecond ticks of duration |
int embb_duration_as_milliseconds |
( |
const embb_duration_t * |
duration, |
|
|
unsigned long long * |
milliseconds |
|
) |
| |
Converts duration to millisecond ticks.
- Returns
- EMBB_SUCCESS
EMBB_UNDERFLOW if duration contains fractions less than a millisecond
EMBB_OVERFLOW if duration is not representable by tick type
- Concurrency
- Not thread-safe
- Parameters
-
[in] | duration | Pointer to duration |
[out] | milliseconds | Pointer to millisecond ticks of duration |
int embb_duration_as_seconds |
( |
const embb_duration_t * |
duration, |
|
|
unsigned long long * |
seconds |
|
) |
| |
Converts duration to second ticks.
- Returns
- EMBB_SUCCESS
EMBB_UNDERFLOW if duration contains fractions less than a second
EMBB_OVERFLOW if duration is not representable by tick type
- Concurrency
- Not thread-safe
- Parameters
-
[in] | duration | Pointer to duration |
[out] | seconds | Pointer to second ticks of duration |
Compares two durations.
- Precondition
lhs
and rhs
are not NULL and properly initialized.
- Returns
- -1 if
lhs
< rhs
0 if lhs
== rhs
1 if lhs
> rhs
- Concurrency
- Not thread-safe
- Parameters
-
[in] | lhs | Pointer to left-hand side operand |
[in] | rhs | Pointer to right-hand side operand |
Sets time point to now.
- Concurrency
- Not thread-safe
- See also
- embb_time_in()
- Parameters
-
[out] | time | Pointer to time point |
Sets time point to now plus the given duration.
- Returns
- EMBB_SUCCESS
EMBB_UNDERFLOW if duration is smaller than implementation allows
EMBB_OVERFLOW if time + duration is larger than implementation allows
- Concurrency
- Not thread-safe
- See also
- embb_time_now()
- Parameters
-
[out] | time | Pointer to time point |
[in] | duration | Pointer to duration |
Compares two time points.
- Precondition
lhs
and rhs
are not NULL and properly initialized.
- Returns
- -1 if
lhs
< rhs
0 if lhs
== rhs
1 if lhs
> rhs
- Concurrency
- Not thread-safe
- Parameters
-
[in] | lhs | Pointer to left-hand side operand |
[in] | rhs | Pointer to right-hand side operand |