From: Moritz Bunkus Date: Wed, 3 Jul 2013 07:44:01 +0000 (+0200) Subject: Refactoring: Verwendung von POSIX::strftime anstelle von localtime() + sprintf X-Git-Tag: release-3.1.0beta1~224 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=0614d6da06dbad4abe017e20320f1015f50a7a66;p=kivitendo-erp.git Refactoring: Verwendung von POSIX::strftime anstelle von localtime() + sprintf --- diff --git a/SL/Common.pm b/SL/Common.pm index c0be296ce..84cb9c20d 100644 --- a/SL/Common.pm +++ b/SL/Common.pm @@ -12,11 +12,13 @@ use utf8; use strict; use Carp; +use English qw(-no_match_vars); use Time::HiRes qw(gettimeofday); use Data::Dumper; use File::Copy; use File::stat; use File::Slurp; +use POSIX (); use SL::DBUtils; @@ -652,15 +654,9 @@ sub copy_file_to_webdav_folder { $::lxdebug->leave_sub(); } -sub get_current_formatted_time { - $main::lxdebug->enter_sub(); - - my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst)=localtime(time); - my $formatted_current_time = sprintf ( "_%04d%02d%02d_%02d%02d%02d", - $year+1900,$mon+1,$mday,$hour,$min,$sec); - $main::lxdebug->leave_sub(); - return $formatted_current_time; +sub get_current_formatted_time { + return POSIX::strftime('_%Y%m%d_%H%M%S', localtime()); } 1;