summaryrefslogtreecommitdiff
path: root/src/modules
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2019-11-16 20:18:24 -0800
committerVito Caputo <vcaputo@pengaru.com>2019-11-16 20:18:24 -0800
commit6b6a02a619c3a076e6c51112dc3ba4896d2108a1 (patch)
tree52534c683e6e64a8b3b5d6612b458aac8ce4028e /src/modules
parentb99536196dffcd7b05d343386370e6ede8f90ca2 (diff)
modules/rtv: conslidate time() calls
Consolidate the time() calls in setup_next_module() by using a now variable.
Diffstat (limited to 'src/modules')
-rw-r--r--src/modules/rtv/rtv.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/modules/rtv/rtv.c b/src/modules/rtv/rtv.c
index d0ec618..7febc85 100644
--- a/src/modules/rtv/rtv.c
+++ b/src/modules/rtv/rtv.c
@@ -62,6 +62,7 @@ rototiller_module_t rtv_module = {
static void setup_next_module(rtv_context_t *ctxt)
{
+ time_t now = time(NULL);
int i;
/* TODO: most of this module stuff should probably be
@@ -78,7 +79,7 @@ static void setup_next_module(rtv_context_t *ctxt)
if (ctxt->module != ctxt->snow_module) {
ctxt->last_module = ctxt->module;
ctxt->module = ctxt->snow_module;
- ctxt->next_switch = time(NULL) + RTV_SNOW_DURATION_SECS;
+ ctxt->next_switch = now + RTV_SNOW_DURATION_SECS;
} else {
do {
i = rand() % ctxt->n_modules;
@@ -94,8 +95,8 @@ static void setup_next_module(rtv_context_t *ctxt)
ctxt->module->description,
ctxt->module->license);
- ctxt->next_switch = time(NULL) + RTV_DURATION_SECS;
- ctxt->next_hide_caption = time(NULL) + RTV_CAPTION_DURATION_SECS;
+ ctxt->next_switch = now + RTV_DURATION_SECS;
+ ctxt->next_hide_caption = now + RTV_CAPTION_DURATION_SECS;
}
if (ctxt->module->create_context)
© All Rights Reserved