153a5a1b3Sopenharmony_ci#ifndef foopulsertclockhfoo 253a5a1b3Sopenharmony_ci#define foopulsertclockhfoo 353a5a1b3Sopenharmony_ci 453a5a1b3Sopenharmony_ci/*** 553a5a1b3Sopenharmony_ci This file is part of PulseAudio. 653a5a1b3Sopenharmony_ci 753a5a1b3Sopenharmony_ci Copyright 2004-2006 Lennart Poettering 853a5a1b3Sopenharmony_ci 953a5a1b3Sopenharmony_ci PulseAudio is free software; you can redistribute it and/or modify 1053a5a1b3Sopenharmony_ci it under the terms of the GNU Lesser General Public License as 1153a5a1b3Sopenharmony_ci published by the Free Software Foundation; either version 2.1 of the 1253a5a1b3Sopenharmony_ci License, or (at your option) any later version. 1353a5a1b3Sopenharmony_ci 1453a5a1b3Sopenharmony_ci PulseAudio is distributed in the hope that it will be useful, but 1553a5a1b3Sopenharmony_ci WITHOUT ANY WARRANTY; without even the implied warranty of 1653a5a1b3Sopenharmony_ci MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1753a5a1b3Sopenharmony_ci Lesser General Public License for more details. 1853a5a1b3Sopenharmony_ci 1953a5a1b3Sopenharmony_ci You should have received a copy of the GNU Lesser General Public 2053a5a1b3Sopenharmony_ci License along with PulseAudio; if not, see <http://www.gnu.org/licenses/>. 2153a5a1b3Sopenharmony_ci***/ 2253a5a1b3Sopenharmony_ci 2353a5a1b3Sopenharmony_ci#include <pulsecore/macro.h> 2453a5a1b3Sopenharmony_ci#include <pulse/sample.h> 2553a5a1b3Sopenharmony_ci 2653a5a1b3Sopenharmony_cistruct timeval; 2753a5a1b3Sopenharmony_ci 2853a5a1b3Sopenharmony_ci/* Something like pulse/timeval.h but based on CLOCK_MONOTONIC */ 2953a5a1b3Sopenharmony_ci 3053a5a1b3Sopenharmony_cistruct timeval *pa_rtclock_get(struct timeval *ts); 3153a5a1b3Sopenharmony_ci 3253a5a1b3Sopenharmony_cipa_usec_t pa_rtclock_age(const struct timeval *tv); 3353a5a1b3Sopenharmony_cibool pa_rtclock_hrtimer(void); 3453a5a1b3Sopenharmony_civoid pa_rtclock_hrtimer_enable(void); 3553a5a1b3Sopenharmony_ci 3653a5a1b3Sopenharmony_ci/* timer with a resolution better than this are considered high-resolution */ 3753a5a1b3Sopenharmony_ci#define PA_HRTIMER_THRESHOLD_USEC 10 3853a5a1b3Sopenharmony_ci 3953a5a1b3Sopenharmony_ci/* bit to set in tv.tv_usec to mark that the timeval is in monotonic time */ 4053a5a1b3Sopenharmony_ci#define PA_TIMEVAL_RTCLOCK ((time_t) (1LU << 30)) 4153a5a1b3Sopenharmony_ci 4253a5a1b3Sopenharmony_cistruct timeval* pa_rtclock_from_wallclock(struct timeval *tv); 4353a5a1b3Sopenharmony_ci 4453a5a1b3Sopenharmony_ci#ifdef HAVE_CLOCK_GETTIME 4553a5a1b3Sopenharmony_cistruct timespec; 4653a5a1b3Sopenharmony_ci 4753a5a1b3Sopenharmony_cipa_usec_t pa_timespec_load(const struct timespec *ts); 4853a5a1b3Sopenharmony_cistruct timespec* pa_timespec_store(struct timespec *ts, pa_usec_t v); 4953a5a1b3Sopenharmony_ci#endif 5053a5a1b3Sopenharmony_ci 5153a5a1b3Sopenharmony_cistruct timeval* pa_timeval_rtstore(struct timeval *tv, pa_usec_t v, bool rtclock); 5253a5a1b3Sopenharmony_ci 5353a5a1b3Sopenharmony_ci#endif 54