Subject: | timegm should be called with 4-digit year |
man Time::Local says
Whenever possible, use an absolute four digit year instead.
With a detailed explanation about ambiguity of 2-digit years above that.
Please review/test/merge the attached patch
Subject: | fix.patch |
Index: Net-FTPSSL-0.39/FTPSSL.pm
===================================================================
--- Net-FTPSSL-0.39.orig/FTPSSL.pm
+++ Net-FTPSSL-0.39/FTPSSL.pm
@@ -2701,10 +2701,10 @@ sub _mdtm {
if ( $GMT_flag ) {
# Use GMT Time [ timegm() vs timelocal() ]
- $timestamp = timegm ( $sec, $min, $hr, $day, $mon - 1, $yr - 1900 );
+ $timestamp = timegm ( $sec, $min, $hr, $day, $mon - 1, $yr );
} else {
# Use Local Time [ timegm() vs timelocal() ]
- $timestamp = timelocal ( $sec, $min, $hr, $day, $mon - 1, $yr - 1900 );
+ $timestamp = timelocal ( $sec, $min, $hr, $day, $mon - 1, $yr );
}
}
}
Index: Net-FTPSSL-0.39/t/10-complex.t
===================================================================
--- Net-FTPSSL-0.39.orig/t/10-complex.t
+++ Net-FTPSSL-0.39/t/10-complex.t
@@ -861,8 +861,8 @@ sub test_mdtm_in_gmt {
if ( defined $tm &&
$tm =~ m/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})$/ ) {
my ($yr, $mon, $day, $hr, $min, $sec) = ($1, $2, $3, $4, $5, $6);
- my $gm = timegm ( $sec, $min, $hr, $day, $mon - 1, $yr - 1900 );
- my $loc = timelocal ( $sec, $min, $hr, $day, $mon - 1, $yr - 1900 );
+ my $gm = timegm ( $sec, $min, $hr, $day, $mon - 1, $yr );
+ my $loc = timelocal ( $sec, $min, $hr, $day, $mon - 1, $yr );
if ( abs ($gm - $now) <= abs ($loc - $now) ) {
$msg = "The FTP/S server correctly uses UTC/GMT time for MDTM.";