Monotonic clock is optional so treat is as such.

git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1780 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
Pierre Ossman 2007-09-10 11:27:56 +00:00
parent 717b164161
commit e1766011ca

View file

@ -139,8 +139,10 @@ struct timespec *pa_rtclock_get(struct timespec *ts) {
pa_assert(ts);
if (!no_monotonic) {
#ifdef CLOCK_MONOTONIC
if (clock_gettime(CLOCK_MONOTONIC, ts) >= 0)
return ts;
#endif
no_monotonic = 1;
}
@ -152,8 +154,10 @@ struct timespec *pa_rtclock_get(struct timespec *ts) {
int pa_rtclock_hrtimer(void) {
struct timespec ts;
#ifdef CLOCK_MONOTONIC
if (clock_getres(CLOCK_MONOTONIC, &ts) >= 0)
return ts.tv_sec == 0 && ts.tv_nsec <= PA_HRTIMER_THRESHOLD_USEC*1000;
#endif
pa_assert_se(clock_getres(CLOCK_REALTIME, &ts) == 0);
return ts.tv_sec == 0 && ts.tv_nsec <= PA_HRTIMER_THRESHOLD_USEC*1000;