summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--input_gadgets.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/input_gadgets.c b/input_gadgets.c
index 6de1094..b988c68 100644
--- a/input_gadgets.c
+++ b/input_gadgets.c
@@ -1036,18 +1036,12 @@ char *gadgets_retrieve_weather_warnings(char *output, int max_len)
for (int i=0; i<warnings_len; i++) {
int is_relevant = 1;
for (int j=i+1; j<warnings_len; j++) {
- if (strcmp(warnings[i].event, warnings[j].event) != 0) {
- fprintf(stderr, "'%s' != '%s'\n", warnings[i].event, warnings[j].event);
+ if (strcmp(warnings[i].event, warnings[j].event) != 0)
continue;
- }
- if ((warnings[i].onset != warnings[j].onset) && ((warnings[i].onset <= time(NULL)) != (warnings[j].onset <= time(NULL)))) {
- fprintf(stderr, "onset: %lu != %lu\n", warnings[i].onset, warnings[j].onset);
+ if ((warnings[i].onset != warnings[j].onset) && ((warnings[i].onset > time(NULL)) || (warnings[j].onset > time(NULL))))
continue;
- }
- if ((warnings[i].expires != warnings[j].expires) && ((warnings[i].expires < time(NULL) + warnings_future_timespan) != (warnings[j].expires < time(NULL) + warnings_future_timespan))) {
- fprintf(stderr, "expires: %lu != %lu\n", warnings[i].expires, warnings[j].expires);
+ if ((warnings[i].expires != warnings[j].expires) && ((warnings[i].expires < time(NULL) + warnings_future_timespan) || (warnings[j].expires < time(NULL) + warnings_future_timespan)))
continue;
- }
is_relevant = 0;
}
if (is_relevant && (output + max_len - ende > 0)) {