aboutsummaryrefslogtreecommitdiffstats
path: root/utils/rspamd_stats.pl
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-07-16 13:42:02 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-07-16 13:42:02 +0100
commit84f6d3012240790df3037e7cac1fd63149d30aa3 (patch)
tree5c4279b1df1659864d77541c1f4d57ffab66a9a4 /utils/rspamd_stats.pl
parent4b6085b959b49dc8e2743b83b83539623293c180 (diff)
downloadrspamd-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-xutils/rspamd_stats.pl22
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}++;