Fix build; change return value of pa_rtclock_hrtimer() to pa_bool

git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1933 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
Lennart Poettering 2007-10-07 13:54:15 +00:00
parent 87cc073653
commit d74fa66f35
2 changed files with 9 additions and 8 deletions

View file

@ -53,12 +53,12 @@ struct timeval *pa_rtclock_get(struct timeval *tv) {
#ifdef CLOCK_MONOTONIC #ifdef CLOCK_MONOTONIC
if (clock_gettime(CLOCK_MONOTONIC, &ts) >= 0) if (clock_gettime(CLOCK_MONOTONIC, &ts) >= 0)
goto out; goto out;
#endif #endif
no_monotonic = 1; no_monotonic = 1;
} }
pa_assert_se(clock_gettime(CLOCK_REALTIME, ts) == 0); pa_assert_se(clock_gettime(CLOCK_REALTIME, &ts) == 0);
out: out:
pa_assert(tv); pa_assert(tv);
@ -75,22 +75,21 @@ out:
#endif #endif
} }
int pa_rtclock_hrtimer(void) { pa_bool_t pa_rtclock_hrtimer(void) {
#ifdef HAVE_CLOCK_GETTIME #ifdef HAVE_CLOCK_GETTIME
struct timespec ts; struct timespec ts;
#ifdef CLOCK_MONOTONIC #ifdef CLOCK_MONOTONIC
if (clock_getres(CLOCK_MONOTONIC, &ts) >= 0) if (clock_getres(CLOCK_MONOTONIC, &ts) >= 0)
return ts.tv_sec == 0 && ts.tv_nsec <= PA_HRTIMER_THRESHOLD_USEC*1000; return ts.tv_sec == 0 && ts.tv_nsec <= PA_HRTIMER_THRESHOLD_USEC*1000;
#endif #endif
pa_assert_se(clock_getres(CLOCK_REALTIME, &ts) == 0); pa_assert_se(clock_getres(CLOCK_REALTIME, &ts) == 0);
return ts.tv_sec == 0 && ts.tv_nsec <= PA_HRTIMER_THRESHOLD_USEC*1000; return ts.tv_sec == 0 && ts.tv_nsec <= PA_HRTIMER_THRESHOLD_USEC*1000;
#else /* HAVE_CLOCK_GETTIME */ #else /* HAVE_CLOCK_GETTIME */
return 0; return FALSE;
#endif #endif
} }

View file

@ -24,13 +24,15 @@
USA. USA.
***/ ***/
#include <pulsecore/macro.h>
struct timeval; struct timeval;
/* Something like pulse/timeval.h but based on CLOCK_MONOTONIC */ /* Something like pulse/timeval.h but based on CLOCK_MONOTONIC */
struct timeval *pa_rtclock_get(struct timeval *ts); struct timeval *pa_rtclock_get(struct timeval *ts);
pa_usec_t pa_rtclock_age(const struct timeval *tv); pa_usec_t pa_rtclock_age(const struct timeval *tv);
int pa_rtclock_hrtimer(void); pa_bool_t pa_rtclock_hrtimer(void);
/* timer with a resolution better than this are considered high-resolution */ /* timer with a resolution better than this are considered high-resolution */
#define PA_HRTIMER_THRESHOLD_USEC 10 #define PA_HRTIMER_THRESHOLD_USEC 10