diff options
author | Lennart Poettering <lennart@poettering.net> | 2004-09-13 23:28:30 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2004-09-13 23:28:30 +0000 |
commit | 829656c5fcd7169e4c2f86f4ad5098ea9aaa5643 (patch) | |
tree | edbca9829ad4b7dfa67f6d7515b3c3c66cc58338 /polyp/util.c | |
parent | fbefe67d52eb89a429505c653d1ea4ce73d4f4e7 (diff) |
new configuration subsystem
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@198 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'polyp/util.c')
-rw-r--r-- | polyp/util.c | 26 |
1 files changed, 26 insertions, 0 deletions
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; +} |