summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2007-10-07 13:54:49 +0000
committerLennart Poettering <lennart@poettering.net>2007-10-07 13:54:49 +0000
commitefc81a8f20652147aa720d8fd3803105081ad2a6 (patch)
treed8369f8ab2796b207ea26fb49b520a7703a688dc
parentd74fa66f35eda1add73313d60c321f63269b3c56 (diff)
add new API function pa_timeval_store()
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1934 fefdeb5f-60dc-0310-8127-8f9354f1896f
-rw-r--r--src/pulse/timeval.c13
-rw-r--r--src/pulse/timeval.h3
2 files changed, 14 insertions, 2 deletions
diff --git a/src/pulse/timeval.c b/src/pulse/timeval.c
index 44d74c94..dcc0bd75 100644
--- a/src/pulse/timeval.c
+++ b/src/pulse/timeval.c
@@ -55,7 +55,7 @@ struct timeval *pa_gettimeofday(struct timeval *tv) {
#else
#define EPOCHFILETIME (116444736000000000LL)
#endif
-
+
FILETIME ft;
LARGE_INTEGER li;
__int64 t;
@@ -79,7 +79,7 @@ struct timeval *pa_gettimeofday(struct timeval *tv) {
pa_usec_t pa_timeval_diff(const struct timeval *a, const struct timeval *b) {
pa_usec_t r;
-
+
pa_assert(a);
pa_assert(b);
@@ -147,3 +147,12 @@ struct timeval* pa_timeval_add(struct timeval *tv, pa_usec_t v) {
return tv;
}
+
+struct timeval* pa_timeval_store(struct timeval *tv, pa_usec_t v) {
+ pa_assert(tv);
+
+ tv->tv_sec = v / PA_USEC_PER_SEC;
+ tv->tv_usec = v % PA_USEC_PER_SEC;
+
+ return tv;
+}
diff --git a/src/pulse/timeval.h b/src/pulse/timeval.h
index e90df9f8..60b9d085 100644
--- a/src/pulse/timeval.h
+++ b/src/pulse/timeval.h
@@ -55,6 +55,9 @@ 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;
+/** Store the specified uec value in the timeval struct */
+struct timeval* pa_timeval_store(struct timeval *tv, pa_usec_t v);
+
PA_C_DECL_END
#endif