From 548fa1a352deacae5c97b90045e01feec1a3e504 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Thu, 17 Oct 2019 16:26:03 +0200 Subject: [PATCH] TT#69200 Use List::Util max() and min() instead of ad-hoc code This is a core module, which requires no additional dependencies. Change-Id: If7034c4478bcf5f39d0a3f1f9b4f09da475fcc52 --- lib/NGCP/BulkProcessor/Utils.pm | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/lib/NGCP/BulkProcessor/Utils.pm b/lib/NGCP/BulkProcessor/Utils.pm index ff24de9..7e97286 100644 --- a/lib/NGCP/BulkProcessor/Utils.pm +++ b/lib/NGCP/BulkProcessor/Utils.pm @@ -9,6 +9,8 @@ use threads; use POSIX qw(strtod locale_h floor fmod); setlocale(LC_NUMERIC, 'C'); +use List::Util qw(max min); + use Data::UUID qw(); use UUID qw(); @@ -708,14 +710,7 @@ sub min_timestamp { my (@timestamps) = @_; - my $min_ts = $timestamps[0]; - foreach my $ts (@timestamps) { - if (($ts cmp $min_ts) < 0) { - $min_ts = $ts; - } - } - - return $min_ts; + return min(@timestamps); } @@ -723,14 +718,7 @@ sub max_timestamp { my (@timestamps) = @_; - my $min_ts = $timestamps[0]; - foreach my $ts (@timestamps) { - if (($ts cmp $min_ts) > 0) { - $min_ts = $ts; - } - } - - return $min_ts; + return max(@timestamps); }