add new API function pa_timeval_store()

git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1934 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
Lennart Poettering 2007-10-07 13:54:49 +00:00
parent d74fa66f35
commit efc81a8f20
2 changed files with 14 additions and 2 deletions

View file

@ -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;
}

View file

@ -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