Utility functions for handling timeval calculations. More...
Go to the source code of this file.
Defines | |
#define | PA_MSEC_PER_SEC ((pa_usec_t) 1000ULL) |
The number of milliseconds in a second. | |
#define | PA_USEC_PER_SEC ((pa_usec_t) 1000000ULL) |
The number of microseconds in a second. | |
#define | PA_NSEC_PER_SEC ((unsigned long long) 1000000000ULL) |
The number of nanoseconds in a second. | |
#define | PA_USEC_PER_MSEC ((pa_usec_t) 1000ULL) |
The number of microseconds in a millisecond. | |
#define | PA_NSEC_PER_MSEC ((unsigned long long) 1000000ULL) |
The number of nanoseconds in a millisecond. | |
#define | PA_NSEC_PER_USEC ((unsigned long long) 1000ULL) |
The number of nanoseconds in a microsecond. | |
#define | PA_USEC_INVALID ((pa_usec_t) -1) |
Invalid time in usec. | |
#define | PA_USEC_MAX ((pa_usec_t) -2) |
Biggest time in usec. | |
Functions | |
struct timeval * | pa_gettimeofday (struct timeval *tv) |
Return the current wallclock timestamp, just like UNIX gettimeofday(). | |
pa_usec_t | pa_timeval_diff (const struct timeval *a, const struct timeval *b) PA_GCC_PURE |
Calculate the difference between the two specified timeval structs. | |
int | pa_timeval_cmp (const struct timeval *a, const struct timeval *b) PA_GCC_PURE |
Compare the two timeval structs and return 0 when equal, negative when a < b, positive otherwise. | |
pa_usec_t | pa_timeval_age (const struct timeval *tv) |
Return the time difference between now and the specified timestamp. | |
struct timeval * | pa_timeval_add (struct timeval *tv, pa_usec_t v) |
Add the specified time in microseconds to the specified timeval structure. | |
struct timeval * | pa_timeval_sub (struct timeval *tv, pa_usec_t v) |
Subtract the specified time in microseconds to the specified timeval structure. | |
struct timeval * | pa_timeval_store (struct timeval *tv, pa_usec_t v) |
Store the specified uec value in the timeval struct. | |
pa_usec_t | pa_timeval_load (const struct timeval *tv) |
Load the specified tv value and return it in usec. |
Utility functions for handling timeval calculations.
#define PA_MSEC_PER_SEC ((pa_usec_t) 1000ULL) |
The number of milliseconds in a second.
#define PA_NSEC_PER_MSEC ((unsigned long long) 1000000ULL) |
The number of nanoseconds in a millisecond.
#define PA_NSEC_PER_SEC ((unsigned long long) 1000000000ULL) |
The number of nanoseconds in a second.
#define PA_NSEC_PER_USEC ((unsigned long long) 1000ULL) |
The number of nanoseconds in a microsecond.
#define PA_USEC_INVALID ((pa_usec_t) -1) |
Invalid time in usec.
#define PA_USEC_MAX ((pa_usec_t) -2) |
Biggest time in usec.
#define PA_USEC_PER_MSEC ((pa_usec_t) 1000ULL) |
The number of microseconds in a millisecond.
#define PA_USEC_PER_SEC ((pa_usec_t) 1000000ULL) |
The number of microseconds in a second.
struct timeval* pa_gettimeofday | ( | struct timeval * | tv ) | [read] |
Return the current wallclock timestamp, just like UNIX gettimeofday().
struct timeval* pa_timeval_add | ( | struct timeval * | tv, |
pa_usec_t | v | ||
) | [read] |
Add the specified time in microseconds to the specified timeval structure.
pa_usec_t pa_timeval_age | ( | const struct timeval * | tv ) |
Return the time difference between now and the specified timestamp.
int pa_timeval_cmp | ( | const struct timeval * | a, |
const struct timeval * | b | ||
) |
Compare the two timeval structs and return 0 when equal, negative when a < b, positive otherwise.
pa_usec_t pa_timeval_diff | ( | const struct timeval * | a, |
const struct timeval * | b | ||
) |
Calculate the difference between the two specified timeval structs.
pa_usec_t pa_timeval_load | ( | const struct timeval * | tv ) |
Load the specified tv value and return it in usec.
struct timeval* pa_timeval_store | ( | struct timeval * | tv, |
pa_usec_t | v | ||
) | [read] |
Store the specified uec value in the timeval struct.
struct timeval* pa_timeval_sub | ( | struct timeval * | tv, |
pa_usec_t | v | ||
) | [read] |
Subtract the specified time in microseconds to the specified timeval structure.