diff options
author | Lennart Poettering <lennart@poettering.net> | 2009-06-22 23:09:46 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2009-06-22 23:09:46 +0200 |
commit | fc33f7ee97da6a8b7263620775b7b74b4c754402 (patch) | |
tree | 519635b1f72acc7613b4b7c4ad70fbc39ab3901b /src/modules/module-device-restore.c | |
parent | 048e576a6dfe2bfe62fa33c74c30cc34057ee740 (diff) | |
parent | e4d914c945c13d23b131d7ba75fbdd03cb6d0043 (diff) |
Merge most of elmarco/rtclock2
Merge commit 'e4d914c945c13d23b131d7ba75fbdd03cb6d0043'
Diffstat (limited to 'src/modules/module-device-restore.c')
-rw-r--r-- | src/modules/module-device-restore.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/src/modules/module-device-restore.c b/src/modules/module-device-restore.c index 3acbdc81d..120b762c1 100644 --- a/src/modules/module-device-restore.c +++ b/src/modules/module-device-restore.c @@ -35,6 +35,7 @@ #include <pulse/volume.h> #include <pulse/timeval.h> #include <pulse/util.h> +#include <pulse/rtclock.h> #include <pulsecore/core-error.h> #include <pulsecore/module.h> @@ -58,7 +59,7 @@ PA_MODULE_USAGE( "restore_volume=<Save/restore volumes?> " "restore_muted=<Save/restore muted states?>"); -#define SAVE_INTERVAL 10 +#define SAVE_INTERVAL (10 * PA_USEC_PER_SEC) static const char* const valid_modargs[] = { "restore_volume", @@ -95,12 +96,11 @@ struct entry { char port[PA_NAME_MAX]; } PA_GCC_PACKED; -static void save_time_callback(pa_mainloop_api*a, pa_time_event* e, const struct timeval *tv, void *userdata) { +static void save_time_callback(pa_mainloop_api*a, pa_time_event* e, const struct timeval *t, void *userdata) { struct userdata *u = userdata; pa_assert(a); pa_assert(e); - pa_assert(tv); pa_assert(u); pa_assert(e == u->save_time_event); @@ -162,14 +162,10 @@ fail: } static void trigger_save(struct userdata *u) { - struct timeval tv; - if (u->save_time_event) return; - pa_gettimeofday(&tv); - tv.tv_sec += SAVE_INTERVAL; - u->save_time_event = u->core->mainloop->time_new(u->core->mainloop, &tv, save_time_callback, u); + u->save_time_event = pa_core_rttime_new(u->core, pa_rtclock_now() + SAVE_INTERVAL, save_time_callback, u); } static pa_bool_t entries_equal(const struct entry *a, const struct entry *b) { |