[pulseaudio-commits] r2234 - in /branches/glitch-free/src/pulsecore: rtclock.c rtclock.h
svnmailer-noreply at 0pointer.de
svnmailer-noreply at 0pointer.de
Fri Apr 11 09:21:14 PDT 2008
Author: lennart
Date: Fri Apr 11 18:21:13 2008
New Revision: 2234
URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=2234&root=pulseaudio&view=rev
Log:
add new API pa_rtclock_from_wallclock()
Modified:
branches/glitch-free/src/pulsecore/rtclock.c
branches/glitch-free/src/pulsecore/rtclock.h
Modified: branches/glitch-free/src/pulsecore/rtclock.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/glitch-free/src/pulsecore/rtclock.c?rev=2234&root=pulseaudio&r1=2233&r2=2234&view=diff
==============================================================================
--- branches/glitch-free/src/pulsecore/rtclock.c (original)
+++ branches/glitch-free/src/pulsecore/rtclock.c Fri Apr 11 18:21:13 2008
@@ -96,3 +96,24 @@
return pa_timeval_load(pa_rtclock_get(&tv));
}
+
+struct timeval* pa_rtclock_from_wallclock(struct timeval *tv) {
+
+#ifdef HAVE_CLOCK_GETTIME
+ struct timeval wc_now, rt_now;
+
+ pa_gettimeofday(&wc_now);
+ pa_rtclock_get(&rt_now);
+
+ pa_assert(tv);
+
+ if (pa_timeval_cmp(&wc_now, tv) < 0)
+ pa_timeval_add(&rt_now, pa_timeval_diff(tv, &wc_now));
+ else
+ pa_timeval_sub(&rt_now, pa_timeval_diff(&wc_now, tv));
+
+ *tv = rt_now;
+#endif
+
+ return tv;
+}
Modified: branches/glitch-free/src/pulsecore/rtclock.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/glitch-free/src/pulsecore/rtclock.h?rev=2234&root=pulseaudio&r1=2233&r2=2234&view=diff
==============================================================================
--- branches/glitch-free/src/pulsecore/rtclock.h (original)
+++ branches/glitch-free/src/pulsecore/rtclock.h Fri Apr 11 18:21:13 2008
@@ -40,4 +40,6 @@
/* timer with a resolution better than this are considered high-resolution */
#define PA_HRTIMER_THRESHOLD_USEC 10
+struct timeval* pa_rtclock_from_wallclock(struct timeval *tv);
+
#endif
More information about the pulseaudio-commits
mailing list