[SimBot-commits] CVS: simbot/plugins weather.pl,1.111,1.112
Status: Abandoned
Brought to you by:
kstange
|
From: Pete P. <fou...@us...> - 2007-01-16 21:58:21
|
Update of /cvsroot/simbot/simbot/plugins In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv15485/plugins Modified Files: weather.pl Log Message: Weather reports from the future will trigger a "check your clock" warning and will no longer be reported as being very recent. Index: weather.pl =================================================================== RCS file: /cvsroot/simbot/simbot/plugins/weather.pl,v retrieving revision 1.111 retrieving revision 1.112 diff -u -d -p -r1.111 -r1.112 --- weather.pl 17 Aug 2006 22:02:57 -0000 1.111 +++ weather.pl 16 Jan 2007 21:58:14 -0000 1.112 @@ -400,7 +400,15 @@ sub got_metar { my $reply = 'As reported '; if(defined $wxhash->{'report_time'}->{'unixtime'}) { - $reply .= &timeago($wxhash->{'report_time'}->{'unixtime'}, 1); + if($wxhash->{'report_time'}->{'unixtime'} > time) { + &debug(1, "weather: METAR is in the future, check your clock!"); + $reply .= sprintf('at %d:%02d', + $wxhash->{'report_time'}->{'hour'}, + $wxhash->{'report_time'}->{'minute'}) + . ' ' . $wxhash->{'report_time'}->{'timezone'}; + } else { + $reply .= &timeago($wxhash->{'report_time'}->{'unixtime'}, 1); + } } else { $reply .= sprintf('at %d:%02d', $wxhash->{'report_time'}->{'hour'}, |