PulseAudio 16.1

Macros | Functions
timeval.h File Reference

Utility functions for handling timeval calculations. More...

Go to the source code of this file.

## Macros
#define | PA_MSEC_PER_SEC ((pa_usec_t) 1000ULL)
| The number of milliseconds in a second. More...
#define | PA_USEC_PER_SEC ((pa_usec_t) 1000000ULL)
| The number of microseconds in a second. More...
#define | PA_NSEC_PER_SEC ((unsigned long long) 1000000000ULL)
| The number of nanoseconds in a second. More...
#define | PA_USEC_PER_MSEC ((pa_usec_t) 1000ULL)
| The number of microseconds in a millisecond. More...
#define | PA_NSEC_PER_MSEC ((unsigned long long) 1000000ULL)
| The number of nanoseconds in a millisecond. More...
#define | PA_NSEC_PER_USEC ((unsigned long long) 1000ULL)
| The number of nanoseconds in a microsecond. More...
#define | PA_USEC_INVALID ((pa_usec_t) -1)
| Invalid time in usec. More...
#define | PA_USEC_MAX ((pa_usec_t) -2)
| Biggest time in usec. More...

## Functions
struct timeval * | pa_gettimeofday (struct timeval *tv)
| Return the current wallclock timestamp, just like UNIX gettimeofday(). More...
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. More...
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. More...
pa_usec_t | pa_timeval_age (const struct timeval *tv)
| Return the time difference between now and the specified timestamp. More...
struct timeval * | pa_timeval_add (struct timeval *tv, pa_usec_t v)
| Add the specified time in microseconds to the specified timeval structure. More...
struct timeval * | pa_timeval_sub (struct timeval *tv, pa_usec_t v)
| Subtract the specified time in microseconds to the specified timeval structure. More...
struct timeval * | pa_timeval_store (struct timeval *tv, pa_usec_t v)
| Store the specified usec value in the timeval struct. More...
pa_usec_t | pa_timeval_load (const struct timeval *tv)
| Load the specified tv value and return it in usec. More...

## Detailed Description

Utility functions for handling timeval calculations.

## Macro Definition Documentation

## ◆ PA_MSEC_PER_SEC

#define PA_MSEC_PER_SEC ((pa_usec_t) 1000ULL)

The number of milliseconds in a second.

## ◆ PA_NSEC_PER_MSEC

#define PA_NSEC_PER_MSEC ((unsigned long long) 1000000ULL)

The number of nanoseconds in a millisecond.

## ◆ PA_NSEC_PER_SEC

#define PA_NSEC_PER_SEC ((unsigned long long) 1000000000ULL)

The number of nanoseconds in a second.

## ◆ PA_NSEC_PER_USEC

#define PA_NSEC_PER_USEC ((unsigned long long) 1000ULL)

The number of nanoseconds in a microsecond.

## ◆ PA_USEC_INVALID

#define PA_USEC_INVALID ((pa_usec_t) -1)

Invalid time in usec.

Since
  0.9.15

## ◆ PA_USEC_MAX

#define PA_USEC_MAX ((pa_usec_t) -2)

Biggest time in usec.

Since
  0.9.18

## ◆ PA_USEC_PER_MSEC

#define PA_USEC_PER_MSEC ((pa_usec_t) 1000ULL)

The number of microseconds in a millisecond.

## ◆ PA_USEC_PER_SEC

#define PA_USEC_PER_SEC ((pa_usec_t) 1000000ULL)

The number of microseconds in a second.

## Function Documentation

## ◆ pa_gettimeofday()

struct timeval * pa_gettimeofday | ( | struct timeval * | tv | ) |

Return the current wallclock timestamp, just like UNIX gettimeofday().

## ◆ pa_timeval_add()

struct timeval * pa_timeval_add | ( | struct timeval * | tv,
|  | pa_usec_t | v
| ) |  |

Add the specified time in microseconds to the specified timeval structure.

## ◆ pa_timeval_age()

pa_usec_t pa_timeval_age | ( | const struct timeval * | tv | ) |

Return the time difference between now and the specified timestamp.

## ◆ pa_timeval_cmp()

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_timeval_diff()

pa_usec_t pa_timeval_diff | ( | const struct timeval * | a,
|  | const struct timeval * | b
| ) |  |

Calculate the difference between the two specified timeval structs.

## ◆ pa_timeval_load()

pa_usec_t pa_timeval_load | ( | const struct timeval * | tv | ) |

Load the specified tv value and return it in usec.

Since
  0.9.7

## ◆ pa_timeval_store()

struct timeval * pa_timeval_store | ( | struct timeval * | tv,
|  | pa_usec_t | v
| ) |  |

Store the specified usec value in the timeval struct.

Since
  0.9.7

## ◆ pa_timeval_sub()

struct timeval * pa_timeval_sub | ( | struct timeval * | tv,
|  | pa_usec_t | v
| ) |  |

Subtract the specified time in microseconds to the specified timeval structure.

Since
  0.9.11