From 41295bbf56ef6df0a0e705149475d91c8d83ff3f Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Sun, 22 Aug 2004 21:13:58 +0000 Subject: 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 --- polyp/util.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'polyp/util.c') 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 #include #include +#include #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; +} -- cgit