[Xfce4-commits] <xfce4-weather-plugin:master> Optimize current conditions update interval a bit.
Harald Judt
noreply at xfce.org
Sun Dec 9 23:44:24 CET 2012
Updating branch refs/heads/master
to c5e073f4462b05f9080bbac1066f2a617116c687 (commit)
from 8d49530dc8d3db010a0b1fba1148c97eba32fde5 (commit)
commit c5e073f4462b05f9080bbac1066f2a617116c687
Author: Harald Judt <h.judt at gmx.at>
Date: Sun Dec 9 19:24:42 2012 +0100
Optimize current conditions update interval a bit.
Use multiples of 5 minutes when data is available.
panel-plugin/weather.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/panel-plugin/weather.c b/panel-plugin/weather.c
index eef705e..097a87e 100644
--- a/panel-plugin/weather.c
+++ b/panel-plugin/weather.c
@@ -293,9 +293,13 @@ update_current_conditions(xfceweather_data *data)
xml_time_free(data->weatherdata->current_conditions);
data->weatherdata->current_conditions = NULL;
}
- /* set time of last update to now, but exact only to the minute */
+ /* use exact 5 minute intervals for calculation */
time(&data->last_conditions_update);
now_tm = *localtime(&data->last_conditions_update);
+ if (now_tm.tm_min % 5 < 5)
+ now_tm.tm_min -= (now_tm.tm_min % 5);
+ if (now_tm.tm_min < 0)
+ now_tm.tm_min = 0;
now_tm.tm_sec = 0;
data->last_conditions_update = mktime(&now_tm);
More information about the Xfce4-commits
mailing list