From 2daee349a1c5d14ba76f6b9c7716258ac2f42929 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Sven=20Sch=C3=B6ling?= Date: Thu, 19 Jun 2014 14:33:52 +0200 Subject: [PATCH] Locale: Warnungen --- SL/Locale.pm | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/SL/Locale.pm b/SL/Locale.pm index 23a399e10..4cbef1684 100644 --- a/SL/Locale.pm +++ b/SL/Locale.pm @@ -364,8 +364,8 @@ sub parse_date { ($yy, $mm, $dd) = ($date =~ /(..)(..)(..)/); } - $dd *= 1; - $mm *= 1; + $_ ||= 0 for ($dd, $mm, $yy); + $_ *= 1 for ($dd, $mm, $yy); $yy = ($yy < 70) ? $yy + 2000 : $yy; $yy = ($yy >= 70 && $yy <= 99) ? $yy + 1900 : $yy; @@ -383,9 +383,12 @@ sub parse_date_to_object { my ($date_str, $time_str) = split m{\s+}, $string, 2; my ($yy, $mm, $dd) = $self->parse_date(\%params, $date_str); - my $millisecond = 0; - my ($hour, $minute, $second) = split m/:/, $time_str; - ($second, $millisecond) = split quotemeta($num_separator), $second, 2; + my ($hour, $minute, $second) = split m/:/, ($time_str || ''); + $second ||= '0'; + + ($second, my $millisecond) = split quotemeta($num_separator), $second, 2; + $_ ||= 0 for ($hour, $minute, $millisecond); + $millisecond = substr $millisecond, 0, 3; $millisecond .= '0' x (3 - length $millisecond); -- 2.20.1