RTRlib
Loading...
Searching...
No Matches
utils_private.h File Reference
#include <stdint.h>
#include <time.h>

Go to the source code of this file.

Functions

int lrtr_get_monotonic_time (time_t *seconds)
 Returns the current time of the CLOCK_MONOTONIC clock.
 
uint32_t lrtr_get_bits (const uint32_t val, const uint8_t from, const uint8_t number)
 Extracts number bits from the passed uint32_t, starting at bit number from.
 

Function Documentation

◆ lrtr_get_bits()

uint32_t lrtr_get_bits ( const uint32_t  val,
const uint8_t  from,
const uint8_t  number 
)

Extracts number bits from the passed uint32_t, starting at bit number from.

The bit with the highest significance is bit 0. All bits that aren't in the specified range will be 0.

Parameters
[in]valuint32_t
[in]fromPosition of the first bit that is extracted.
[in]numberHow many bits will be extracted.
Returns
a uint32_t, where all bits that aren't in the specified range are set to 0.

◆ lrtr_get_monotonic_time()

int lrtr_get_monotonic_time ( time_t *  seconds)

Returns the current time of the CLOCK_MONOTONIC clock.

Parameters
[in]secondsTime in seconds since some unspecified starting point.
Returns
0 on successs
-1 on error