summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--input_gadgets.c16
-rw-r--r--input_gadgets.h1
2 files changed, 13 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;
diff --git a/input_gadgets.h b/input_gadgets.h
index 6f22056..532d55f 100644
--- a/input_gadgets.h
+++ b/input_gadgets.h
@@ -25,6 +25,7 @@ typedef struct {
char *text_output;
double *double_output;
int output_ready, force_update, keep_running;
+ time_t last_update;
} t_input_thread;
void *gadgets_watch_current_temperature(void *param);