diff options
author | Erich Eckner <git@eckner.net> | 2020-09-07 13:27:34 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2020-09-07 13:27:34 +0200 |
commit | df22be10087a70feef310edeb1ba3c2a7bf1b826 (patch) | |
tree | 8437f5cbde77aae52a86ee7546f71f6fde855329 /input_gadgets.c | |
parent | 499bcc955d9eb72bb7882b3c919eb534a72eb360 (diff) | |
download | anzeige-df22be10087a70feef310edeb1ba3c2a7bf1b826.tar.xz |
input_gadgets: save time of last update
Diffstat (limited to 'input_gadgets.c')
-rw-r--r-- | input_gadgets.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/input_gadgets.c b/input_gadgets.c index b988c68..6c3544d 100644 --- a/input_gadgets.c +++ b/input_gadgets.c @@ -251,12 +251,14 @@ void *gadgets_watch_current_temperature(void *param) next_update = time(NULL) + 600; // 10 minutes ahead next_dns_query = time(NULL) + 30; // 1/2 minute ahead memset(p->text_output, 0, MAX_TEXT_OUTPUT_LEN); - if (!gadgets_retrieve_current_temperature( + if (gadgets_retrieve_current_temperature( p->text_output, MAX_TEXT_OUTPUT_LEN-1, &p->double_output[0], &p->double_output[1] )) { + p->last_update = time(NULL); + } else { fprintf(stderr, "gadgets_retrieve_current_temperature failed\n"); snprintf(p->text_output, MAX_TEXT_OUTPUT_LEN, "gadgets_retrieve_current_temperature failed"); p->double_output[0] = 0; @@ -456,10 +458,12 @@ void *gadgets_watch_weather_forecast(void *param) next_update = time(NULL) + 600; // 10 minutes ahead next_dns_query = time(NULL) + 30; // 1/2 minute ahead memset(p->text_output, 0, MAX_TEXT_OUTPUT_LEN); - if (!gadgets_retrieve_weather_forecast( + if (gadgets_retrieve_weather_forecast( p->text_output, MAX_TEXT_OUTPUT_LEN-1 )) { + p->last_update = time(NULL); + } else { fprintf(stderr, "gadgets_retrieve_weather_forecast failed\n"); snprintf(p->text_output, MAX_TEXT_OUTPUT_LEN, "gadgets_retrieve_weather_forecast failed"); } @@ -1086,10 +1090,12 @@ void *gadgets_watch_weather_warnings(void *param) next_update = time(NULL) + 600; // 10 minutes ahead next_dns_query = time(NULL) + 30; // 1/2 minute ahead memset(p->text_output, 0, MAX_TEXT_OUTPUT_LEN); - if (!gadgets_retrieve_weather_warnings( + if (gadgets_retrieve_weather_warnings( p->text_output, MAX_TEXT_OUTPUT_LEN-1 )) { + p->last_update = time(NULL); + } else { fprintf(stderr, "gadgets_retrieve_weather_warnings failed\n"); snprintf(p->text_output, MAX_TEXT_OUTPUT_LEN, "gadgets_retrieve_weather_warnings failed"); } @@ -1217,12 +1223,14 @@ void *gadgets_watch_humidity(void *param) if (((time(NULL) >= next_update) || (p->force_update)) && (!p->output_ready)) { next_update = time(NULL) + 600; // 10 minutes ahead next_dns_query = time(NULL) + 30; // 1/2 minute ahead - if (!gadgets_retrieve_humidity( + if (gadgets_retrieve_humidity( p->text_output, MAX_TEXT_OUTPUT_LEN-1, &p->double_output[0], &p->double_output[1] )) { + p->last_update = time(NULL); + } else { fprintf(stderr, "gadgets_retrieve_humidity failed\n"); snprintf(p->text_output, MAX_TEXT_OUTPUT_LEN, "gadgets_retrieve_humidity failed\n"); p->double_output[0]=0; |