]> source.dussan.org Git - rspamd.git/commitdiff
[Minor] Fix end/start times when processing multiple log files
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 16 Jul 2018 12:42:02 +0000 (13:42 +0100)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 16 Jul 2018 12:42:02 +0000 (13:42 +0100)
utils/rspamd_stats.pl

index b997ff525501f33cb7f0929bd05ba989bde29656..ac7b1349f167c092a1b0521ac5f0f298e31af45e 100755 (executable)
@@ -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}++;