PulseAudio  16.0
timeval.h
Go to the documentation of this file.
1 #ifndef footimevalhfoo
2 #define footimevalhfoo
3 
4 /***
5  This file is part of PulseAudio.
6 
7  Copyright 2004-2006 Lennart Poettering
8  Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
9 
10  PulseAudio is free software; you can redistribute it and/or modify
11  it under the terms of the GNU Lesser General Public License as
12  published by the Free Software Foundation; either version 2.1 of the
13  License, or (at your option) any later version.
14 
15  PulseAudio is distributed in the hope that it will be useful, but
16  WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18  Lesser General Public License for more details.
19 
20  You should have received a copy of the GNU Lesser General Public
21  License along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
22 ***/
23 
24 #include <pulse/cdecl.h>
25 #include <pulse/gccmacro.h>
26 #include <pulse/sample.h>
27 #include <pulse/version.h>
28 
32 PA_C_DECL_BEGIN
33 
35 #define PA_MSEC_PER_SEC ((pa_usec_t) 1000ULL)
36 
38 #define PA_USEC_PER_SEC ((pa_usec_t) 1000000ULL)
39 
41 #define PA_NSEC_PER_SEC ((unsigned long long) 1000000000ULL)
42 
44 #define PA_USEC_PER_MSEC ((pa_usec_t) 1000ULL)
45 
47 #define PA_NSEC_PER_MSEC ((unsigned long long) 1000000ULL)
48 
50 #define PA_NSEC_PER_USEC ((unsigned long long) 1000ULL)
51 
53 #define PA_USEC_INVALID ((pa_usec_t) -1)
54 
56 #define PA_USEC_MAX ((pa_usec_t) -2)
57 
58 struct timeval;
59 
61 struct timeval *pa_gettimeofday(struct timeval *tv);
62 
65 pa_usec_t pa_timeval_diff(const struct timeval *a, const struct timeval *b) PA_GCC_PURE;
66 
68 int pa_timeval_cmp(const struct timeval *a, const struct timeval *b) PA_GCC_PURE;
69 
71 pa_usec_t pa_timeval_age(const struct timeval *tv);
72 
74 struct timeval* pa_timeval_add(struct timeval *tv, pa_usec_t v);
75 
77 struct timeval* pa_timeval_sub(struct timeval *tv, pa_usec_t v);
78 
80 struct timeval* pa_timeval_store(struct timeval *tv, pa_usec_t v);
81 
83 pa_usec_t pa_timeval_load(const struct timeval *tv);
84 
85 PA_C_DECL_END
86 
87 #endif
GCC attribute macros.
#define PA_GCC_PURE
This function's return value depends only the arguments list and global state.
Definition: gccmacro.h:71
Constants and routines for sample type handling.
uint64_t pa_usec_t
Type for usec specifications (unsigned).
Definition: sample.h:264
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.
struct timeval * pa_timeval_add(struct timeval *tv, pa_usec_t v)
Add the specified time in microseconds to the specified timeval structure.
pa_usec_t pa_timeval_load(const struct timeval *tv)
Load the specified tv value and return it in usec.
struct timeval * pa_gettimeofday(struct timeval *tv)
Return the current wallclock timestamp, just like UNIX gettimeofday().
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) PA_GCC_PURE
Compare the two timeval structs and return 0 when equal, negative when a < b, positive otherwise.
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 usec value in the timeval struct.