[Xfce4-commits] <xfce4-weather-plugin:master> Current weather: Deal with timeslices that are in the near future.
Harald Judt
noreply at xfce.org
Tue Dec 4 18:26:01 CET 2012
Updating branch refs/heads/master
to 16a98047d5bc4bb5a30bf346b0b29b8e941195f7 (commit)
from a65c97177b67d1987116a81d6b595a2ea6bb184d (commit)
commit 16a98047d5bc4bb5a30bf346b0b29b8e941195f7
Author: Harald Judt <h.judt at gmx.at>
Date: Tue Dec 4 18:20:47 2012 +0100
Current weather: Deal with timeslices that are in the near future.
It's no good interpolating when the current time is not in the timeslice.
This is just a quick fix, in fact it may be better to choose a different,
bigger interval.
panel-plugin/weather-data.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/panel-plugin/weather-data.c b/panel-plugin/weather-data.c
index 64fa21a..2c9d7a2 100644
--- a/panel-plugin/weather-data.c
+++ b/panel-plugin/weather-data.c
@@ -470,8 +470,14 @@ make_combined_timeslice(xml_weather *data,
if (start == NULL) {
comb->point = end->start;
start = end;
- } else if (between_t) /* only interpolate if requested */
- comb->point = *between_t;
+ } else if (ipol) {
+ /* deal with timeslices that are in the near future and use point
+ data available at the start of the interval */
+ if (difftime(*between_t, end->start) <= 0)
+ comb->point = start->start;
+ else
+ comb->point = *between_t;
+ }
comb->start = interval->start;
comb->end = interval->end;
More information about the Xfce4-commits
mailing list