From 6b6a02a619c3a076e6c51112dc3ba4896d2108a1 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Sat, 16 Nov 2019 20:18:24 -0800 Subject: modules/rtv: conslidate time() calls Consolidate the time() calls in setup_next_module() by using a now variable. --- src/modules/rtv/rtv.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'src/modules') 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) -- cgit v1.2.1