$NetBSD: patch-ag,v 1.3 2024/04/11 10:23:44 bouyer Exp $ * Avoid to use timelocal.pl which cause obsolete warning with perl 5.14. * Make sure to use 4-digit year. * Fix deprecation warning (change ' to ::) for newer perl --- dateconv.pl.orig 2024-04-11 11:08:05.967542752 +0200 +++ dateconv.pl 2024-04-11 11:07:48.795406481 +0200 @@ -47,7 +47,8 @@ } -require 'timelocal.pl'; +use Time::Local; + package dateconv; # Use timelocal rather than gmtime. @@ -74,7 +75,7 @@ # input date and time string from ftp "ls -l", such as Mmm dd yyyy or # Mmm dd HH:MM, # return $time number via gmlocal( $string ). -sub main'lstime_to_time +sub main::lstime_to_time { package dateconv; @@ -133,15 +134,15 @@ $year += 50 if 37 < $year && $year < 70 ; if( $use_timelocal ){ - return &'timelocal( $secs, $mins, $hours, $day, $month, $year ); + return &::timelocal( $secs, $mins, $hours, $day, $month, $year ); } else { - return &'timegm( $secs, $mins, $hours, $day, $month, $year ); + return &::timegm( $secs, $mins, $hours, $day, $month, $year ); } } # input time number, output GMT string as "dd Mmm YY HH:MM" -sub main'time_to_standard +sub main::time_to_standard { package dateconv; @@ -149,5 +150,5 @@ local( $sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst ) = gmtime( $time ); - return sprintf( "%2d $months[ $mon + 1 ] %2d %02d:%02d", $mday, $year, $hour, $min ); + return sprintf( "%2d $months[ $mon + 1 ] %4d %02d:%02d", $mday, $year + 1900, $hour, $min ); }