diff fetch_weather.pl @ 371:36869897f21d

fetch_weather: Purge sufficiently old data.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 06 Jan 2016 20:41:47 +0200
parents ce70b4b21e7a
children bc7746ca622e
line wrap: on
line diff
--- a/fetch_weather.pl	Tue Dec 29 12:01:20 2015 +0200
+++ b/fetch_weather.pl	Wed Jan 06 20:41:47 2016 +0200
@@ -488,6 +488,19 @@
 
 
 ###
+### Purge very old entries
+###
+my $wqtime = time();
+foreach my $key (keys %$weatherdata)
+{
+  if ($wqtime - $weatherdata->{$key}[1] > (60*60*6))
+  {
+    delete $$weatherdata{$key};
+  }
+}
+
+
+###
 ### Output
 ###
 if (opt_chk_valid("outfile", 1))