From 829656c5fcd7169e4c2f86f4ad5098ea9aaa5643 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Mon, 13 Sep 2004 23:28:30 +0000 Subject: new configuration subsystem git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@198 fefdeb5f-60dc-0310-8127-8f9354f1896f --- polyp/util.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'polyp/util.c') diff --git a/polyp/util.c b/polyp/util.c index 1dbb8697..039ec264 100644 --- a/polyp/util.c +++ b/polyp/util.c @@ -268,6 +268,22 @@ pa_usec_t pa_age(const struct timeval *tv) { return pa_timeval_diff(&now, tv); } +void pa_timeval_add(struct timeval *tv, pa_usec_t v) { + unsigned long secs; + assert(tv); + + secs = (v/1000000); + tv->tv_sec += (unsigned long) secs; + v -= secs*1000000; + + tv->tv_usec += v; + + while (tv->tv_usec >= 1000000) { + tv->tv_sec++; + tv->tv_usec -= 1000000; + } +} + #define NICE_LEVEL (-15) void pa_raise_priority(void) { @@ -347,3 +363,13 @@ char *pa_path_get_filename(const char *p) { return (char*) p; } + +int pa_parse_boolean(const char *v) { + + if (!strcmp(v, "1") || !strcasecmp(v, "yes") || !strcasecmp(v, "y") || !strcasecmp(v, "on")) + return 1; + else if (!strcmp(v, "0") || !strcasecmp(v, "no") || !strcasecmp(v, "n") || !strcasecmp(v, "off")) + return 0; + + return -1; +} -- cgit