Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Time-Local CPAN distribution.

Report information
The Basics
Id: 124787
Status: resolved
Priority: 0/
Queue: Time-Local

People
Owner: Nobody in particular
Requestors: bitcardbmw [...] lsmod.de
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: 1.25
Fixed in: (no value)

Attachments


Subject: Local.t test fails in 2020
MIME-Version: 1.0
X-Mailer: MIME-tools 5.504 (Entity 5.504)
X-RT-Interface: Web
Message-ID: <rt-4.0.18-26109-1521198617-998.0-0-0 [...] rt.cpan.org>
X-RT-Original-Encoding: utf-8
Content-Type: multipart/mixed; boundary="----------=_1521198617-26109-2"
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 0
Content-Disposition: inline
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: binary
Content-Length: 435
Download (untitled) / with headers
text/plain 435b
While working on reproducible builds for openSUSE, I was trying to build perl-5.26.1 in 2033 and found that then the cpan/Time-Local/t/Local.t test fails. In 2020, a year of 70 starts to mean 2070. The module's man page tells about this ambiguity of 2-digit years. please review/test/merge the attached patch. The last chunk is not strictly required until 2049 but IMHO it helps to have tests document how to correctly use a module
Subject: 0001-Fix-Time-Local-tests.patch
MIME-Version: 1.0
Content-Type: text/x-patch; name="0001-Fix-Time-Local-tests.patch"
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline; filename="0001-Fix-Time-Local-tests.patch"
Content-Transfer-Encoding: binary
Content-Length: 2265
From c4c733988fd2012cf517c021bb31ec13097b2d48 Mon Sep 17 00:00:00 2001 From: "Bernhard M. Wiedemann" <bwiedemann@suse.de> Date: Fri, 16 Mar 2018 11:44:01 +0100 Subject: [PATCH] Fix Time::Local tests in 2020, year 70 changes its meaning to 2070 so we do what man Time::Local recommends and use 4-digit years --- cpan/Time-Local/t/Local.t | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/cpan/Time-Local/t/Local.t b/cpan/Time-Local/t/Local.t index 634139695f..e28c6d2129 100644 --- a/cpan/Time-Local/t/Local.t +++ b/cpan/Time-Local/t/Local.t @@ -96,7 +96,7 @@ SKIP: { # Test timelocal() { - my $year_in = $year < 70 ? $year + 1900 : $year; + my $year_in = $year + 1900; my $time = timelocal( $sec, $min, $hour, $mday, $mon, $year_in ); my ( $s, $m, $h, $D, $M, $Y ) = localtime($time); @@ -111,7 +111,7 @@ SKIP: { # Test timegm() { - my $year_in = $year < 70 ? $year + 1900 : $year; + my $year_in = $year + 1900; my $time = timegm( $sec, $min, $hour, $mday, $mon, $year_in ); my ( $s, $m, $h, $D, $M, $Y ) = gmtime($time); @@ -128,7 +128,6 @@ SKIP: { for (@bad_time) { my ( $year, $mon, $mday, $hour, $min, $sec ) = @$_; - $year -= 1900; $mon--; eval { timegm( $sec, $min, $hour, $mday, $mon, $year ) }; @@ -138,19 +137,19 @@ for (@bad_time) { { is( - timelocal( 0, 0, 1, 1, 0, 90 ) - timelocal( 0, 0, 0, 1, 0, 90 ), 3600, + timelocal( 0, 0, 1, 1, 0, 1990 ) - timelocal( 0, 0, 0, 1, 0, 1990 ), 3600, 'one hour difference between two calls to timelocal' ); is( - timelocal( 1, 2, 3, 1, 0, 100 ) - timelocal( 1, 2, 3, 31, 11, 99 ), + timelocal( 1, 2, 3, 1, 0, 2000 ) - timelocal( 1, 2, 3, 31, 11, 1999 ), 24 * 3600, 'one day difference between two calls to timelocal' ); # Diff beween Jan 1, 1980 and Mar 1, 1980 = (31 + 29 = 60 days) is( - timegm( 0, 0, 0, 1, 2, 80 ) - timegm( 0, 0, 0, 1, 0, 80 ), + timegm( 0, 0, 0, 1, 2, 1980 ) - timegm( 0, 0, 0, 1, 0, 1980 ), 60 * 24 * 3600, '60 day difference between two calls to timegm' ); -- 2.13.6
MIME-Version: 1.0
In-Reply-To: <rt-4.0.18-26109-1521198617-998.0-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <rt-4.0.18-26109-1521198617-998.0-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-5711-1528559522-1863.124787-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 22
Thanks! Fixed in 1.27.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.