From: Vsevolod Stakhov Date: Mon, 16 Jul 2018 12:42:02 +0000 (+0100) Subject: [Minor] Fix end/start times when processing multiple log files X-Git-Tag: 1.7.9~113 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=84f6d3012240790df3037e7cac1fd63149d30aa3;p=rspamd.git [Minor] Fix end/start times when processing multiple log files --- diff --git a/utils/rspamd_stats.pl b/utils/rspamd_stats.pl index b997ff525..ac7b1349f 100755 --- a/utils/rspamd_stats.pl +++ b/utils/rspamd_stats.pl @@ -508,12 +508,22 @@ sub ProcessLog { next if ( $skip != 0 ); - $timeStamp{'end'} = $ts; - $timeStamp{'start'} //= $timeStamp{'end'}; - $scanTime{'min'} = $scan_time - if ( !exists $scanTime{'min'} || $scanTime{'min'} > $scan_time ); - $scanTime{'max'} = $scan_time - if ( $scanTime{'max'} < $scan_time ); + if (defined($timeStamp{'end'})) { + $timeStamp{'end'} = $ts if ( $ts gt $timeStamp{'end'} ); + } + else { + $timeStamp{'end'} = $ts; + } + + if (defined($timeStamp{'start'})) { + $timeStamp{'start'} = $ts if ( $ts lt $timeStamp{'start'} ); + } + else { + $timeStamp{'start'} = $ts; + } + + $scanTime{'min'} = $scan_time if ( !exists $scanTime{'min'} || $scanTime{'min'} > $scan_time ); + $scanTime{'max'} = $scan_time if ( $scanTime{'max'} < $scan_time ); $scanTime{'total'} += $scan_time; $action{$act}++;