Skip Menu |

This queue is for tickets about the TimeDate CPAN distribution.

Report information
The Basics
Id: 112559
Status: open
Priority: 0/
Queue: TimeDate

People
Owner: Nobody in particular
Requestors: SREZIC [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 2.30
Fixed in: (no value)



Subject: t/date.t fails today (2016-02-29)
Today (2016-02-29): $ perl5.22.1 -Mblib t/date.t ... not ok 61 # 1999 10:02:18 "GMT" ... Fake yesterday's date: $ perl5.22.1 -MTime::Fake=-1d -Mblib t/date.t ... 1999 10:02:18 "GMT" Sun Feb 28 10:02:18 1999 GMT ok 61 ... Fake tomorrow's date: $ perl5.22.1 -MTime::Fake=+1d -Mblib t/date.t ... 1999 10:02:18 "GMT" Mon Mar 1 10:02:18 1999 GMT ok 61 ...
On 2016-02-29 02:38:41, SREZIC wrote: Show quoted text
> Today (2016-02-29): > > $ perl5.22.1 -Mblib t/date.t > ... > not ok 61 # 1999 10:02:18 "GMT" > ... > > Fake yesterday's date: > > $ perl5.22.1 -MTime::Fake=-1d -Mblib t/date.t > ... > 1999 10:02:18 "GMT" Sun Feb 28 10:02:18 1999 GMT > ok 61 > ... > > Fake tomorrow's date: > > $ perl5.22.1 -MTime::Fake=+1d -Mblib t/date.t > ... > 1999 10:02:18 "GMT" Mon Mar 1 10:02:18 1999 GMT > ok 61 > ...
... and this happens every leap day, it seems: $ perl -MTime::Local=timelocal -e 'warn timelocal(0,0,12,29,2-1,2020)' 1582977600 at -e line 1. $ perl5.22.1 -MTime::Fake=1582977600 -Mblib t/date.t ... not ok 61 # 1999 10:02:18 "GMT" ...
From: arc [...] cpan.org
On Mon Feb 29 02:41:32 2016, SREZIC wrote: Show quoted text
> ... and this happens every leap day, it seems: > > $ perl -MTime::Local=timelocal -e 'warn timelocal(0,0,12,29,2-1,2020)' > 1582977600 at -e line 1. > $ perl5.22.1 -MTime::Fake=1582977600 -Mblib t/date.t > ... > not ok 61 # 1999 10:02:18 "GMT" > ...
I think the test in question is incorrect. It's trying to parse the string as a date, filling in the month and day (but not the year) from today's date whenever it gets run, but setting the year to 1999. This will fail on every leap day, because no such date exists in 1999. Picking any leap year as the year will make this pass; see the attached patch, which uses 2000. Thanks. -- Aaron Crane
Subject: 0001-Fix-test-to-run-on-leap-days.patch
From b238affd63352d9a549d12a4e93e25bf4436890f Mon Sep 17 00:00:00 2001 From: Aaron Crane <arc@cpan.org> Date: Mon, 29 Feb 2016 13:44:41 +0000 Subject: [PATCH] Fix test to run on leap days This test tries to build a date from the hard-coded year 1999, and the month and day of the date it gets run. This will always fail on February 29th. Hard-coding a leap year instead of 1999 fixes the problem. --- t/date.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/date.t b/t/date.t index a2649ae..e815ba6 100644 --- a/t/date.t +++ b/t/date.t @@ -62,7 +62,7 @@ Mon, 21 Nov 94 14:34:28 -0500 Fri, 18 Nov 1994 12:05:47 -0800 (PST) Fri, 18 Nov 1994 12:36:26 -0800 (PST) Wed, 16 Nov 1994 15:58:58 GMT -1999 10:02:18 "GMT" +2000 10:02:18 "GMT" Sun, 06 Nov 94 14:27:40 -0500 Mon, 07 Nov 94 08:20:13 -0500 Mon, 07 Nov 94 16:48:42 -0500 -- 2.7.2