diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-07-16 13:42:02 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-07-16 13:42:02 +0100 |
commit | 84f6d3012240790df3037e7cac1fd63149d30aa3 (patch) | |
tree | 5c4279b1df1659864d77541c1f4d57ffab66a9a4 /utils/rspamd_stats.pl | |
parent | 4b6085b959b49dc8e2743b83b83539623293c180 (diff) | |
download | rspamd-84f6d3012240790df3037e7cac1fd63149d30aa3.tar.gz rspamd-84f6d3012240790df3037e7cac1fd63149d30aa3.zip |
[Minor] Fix end/start times when processing multiple log files
Diffstat (limited to 'utils/rspamd_stats.pl')
-rwxr-xr-x | utils/rspamd_stats.pl | 22 |
1 files changed, 16 insertions, 6 deletions
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}++; |