summaryrefslogtreecommitdiffstats
path: root/polyp/util.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2004-08-22 21:13:58 +0000
committerLennart Poettering <lennart@poettering.net>2004-08-22 21:13:58 +0000
commit41295bbf56ef6df0a0e705149475d91c8d83ff3f (patch)
treecd7d52d972d24fa3b6298d1a19a213ce25dcf44a /polyp/util.c
parentea4805a0fd4aea6db4c99e1187aca8e013e4dc24 (diff)
new features:
future cancellation corking flushing for playback streams in native protocol git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@152 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'polyp/util.c')
-rw-r--r--polyp/util.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/polyp/util.c b/polyp/util.c
index 2878c546..6c8febb6 100644
--- a/polyp/util.c
+++ b/polyp/util.c
@@ -36,6 +36,7 @@
#include <pwd.h>
#include <signal.h>
#include <pthread.h>
+#include <sys/time.h>
#include "util.h"
#include "xmalloc.h"
@@ -192,3 +193,23 @@ char *pa_get_host_name(char *s, size_t l) {
s[l-1] = 0;
return s;
}
+
+uint32_t pa_age(struct timeval *tv) {
+ struct timeval now;
+ uint32_t r;
+ assert(tv);
+
+ if (tv->tv_sec == 0)
+ return 0;
+
+ gettimeofday(&now, NULL);
+
+ r = (now.tv_sec-tv->tv_sec) * 1000000;
+
+ if (now.tv_usec >= tv->tv_usec)
+ r += now.tv_usec - tv->tv_usec;
+ else
+ r -= tv->tv_usec - now.tv_usec;
+
+ return r;
+}