[pulseaudio-commits] r2240 - in /branches/glitch-free/src/pulse: timeval.c timeval.h

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Fri Apr 11 09:28:50 PDT 2008


Author: lennart
Date: Fri Apr 11 18:28:49 2008
New Revision: 2240

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=2240&root=pulseaudio&view=rev
Log:
add new API function pa_timeval_add()

Modified:
    branches/glitch-free/src/pulse/timeval.c
    branches/glitch-free/src/pulse/timeval.h

Modified: branches/glitch-free/src/pulse/timeval.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/glitch-free/src/pulse/timeval.c?rev=2240&root=pulseaudio&r1=2239&r2=2240&view=diff
==============================================================================
--- branches/glitch-free/src/pulse/timeval.c (original)
+++ branches/glitch-free/src/pulse/timeval.c Fri Apr 11 18:28:49 2008
@@ -148,6 +148,24 @@
     return tv;
 }
 
+struct timeval* pa_timeval_sub(struct timeval *tv, pa_usec_t v) {
+    unsigned long secs;
+    pa_assert(tv);
+
+    secs = (unsigned long) (v/PA_USEC_PER_SEC);
+    tv->tv_sec -= secs;
+    v -= ((pa_usec_t) secs) * PA_USEC_PER_SEC;
+
+    if (tv->tv_usec >= (suseconds_t) v)
+        tv->tv_usec -= (suseconds_t) v;
+    else {
+        tv->tv_sec --;
+        tv->tv_usec = tv->tv_usec + PA_USEC_PER_SEC - v;
+    }
+
+    return tv;
+}
+
 struct timeval* pa_timeval_store(struct timeval *tv, pa_usec_t v) {
     pa_assert(tv);
 

Modified: branches/glitch-free/src/pulse/timeval.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/glitch-free/src/pulse/timeval.h?rev=2240&root=pulseaudio&r1=2239&r2=2240&view=diff
==============================================================================
--- branches/glitch-free/src/pulse/timeval.h (original)
+++ branches/glitch-free/src/pulse/timeval.h Fri Apr 11 18:28:49 2008
@@ -26,6 +26,7 @@
 ***/
 
 #include <pulse/cdecl.h>
+#include <pulse/gccmacro.h>
 #include <pulse/sample.h>
 
 /** \file
@@ -54,7 +55,10 @@
 pa_usec_t pa_timeval_age(const struct timeval *tv);
 
 /** Add the specified time inmicroseconds to the specified timeval structure */
-struct timeval* pa_timeval_add(struct timeval *tv, pa_usec_t v) PA_GCC_PURE;
+struct timeval* pa_timeval_add(struct timeval *tv, pa_usec_t v);
+
+/** Subtract the specified time inmicroseconds to the specified timeval structure. \since 0.9.11 */
+struct timeval* pa_timeval_sub(struct timeval *tv, pa_usec_t v);
 
 /** Store the specified uec value in the timeval struct. \since 0.9.7 */
 struct timeval* pa_timeval_store(struct timeval *tv, pa_usec_t v);




More information about the pulseaudio-commits mailing list