atoomic / perl-TimeDate

time & date parsing and formatting perl library
http://search.cpan.org/dist/TimeDate/
1 stars 4 forks source link

tests fails in 2020 [rt.cpan.org #124509] #36

Closed atoomic closed 4 years ago

atoomic commented 4 years ago

Migrated from rt.cpan.org#124509 (status was 'open')

Requestors:

Attachments:

From bitcardbmw@lsmod.de on 2018-02-21 11:13:18 :

similar to https://rt.cpan.org/Public/Bug/Display.html?id=124508

after 2020-01-01 $offset was shifting dates from 2002 to 2102

This trivial patch fixed it for me:

Index: TimeDate-2.30/t/getdate.t
===================================================================
--- TimeDate-2.30.orig/t/getdate.t
+++ TimeDate-2.30/t/getdate.t
@@ -156,7 +156,7 @@ Jul 22 10:00:00 UTC 2002         ;102733200
 !;

 require Time::Local;
-my $offset = Time::Local::timegm(0,0,0,1,0,70);
+my $offset = Time::Local::timegm(0,0,0,1,0,1970);

 @data = split(/\n/, $data);

From srezic@cpan.org on 2020-01-01 01:49:34 :

On 2018-02-21 06:13:18, bmwiedemann wrote:
> similar to https://rt.cpan.org/Public/Bug/Display.html?id=124508
> 
> after 2020-01-01 $offset was shifting dates from 2002 to 2102
> 
> This trivial patch fixed it for me:
> 
> Index: TimeDate-2.30/t/getdate.t
> ===================================================================
> --- TimeDate-2.30.orig/t/getdate.t
> +++ TimeDate-2.30/t/getdate.t
> @@ -156,7 +156,7 @@ Jul 22 10:00:00 UTC 2002         ;102733200
>  !;
>  
>  require Time::Local;
> -my $offset = Time::Local::timegm(0,0,0,1,0,70);
> +my $offset = Time::Local::timegm(0,0,0,1,0,1970);
>  
>  @data = split(/\n/, $data);
>  

Confirmed. Since today the test suite is failing. Proposed fix seems to work.

From srezic@cpan.org on 2020-01-02 10:53:12 :

On 2019-12-31 20:49:34, SREZIC wrote:
> On 2018-02-21 06:13:18, bmwiedemann wrote:
> > similar to https://rt.cpan.org/Public/Bug/Display.html?id=124508
> >
> > after 2020-01-01 $offset was shifting dates from 2002 to 2102
> >
> > This trivial patch fixed it for me:
> >
> > Index: TimeDate-2.30/t/getdate.t
> > ===================================================================
> > --- TimeDate-2.30.orig/t/getdate.t
> > +++ TimeDate-2.30/t/getdate.t
> > @@ -156,7 +156,7 @@ Jul 22 10:00:00 UTC 2002         ;102733200
> >  !;
> >
> > require Time::Local;
> > -my $offset = Time::Local::timegm(0,0,0,1,0,70);
> > +my $offset = Time::Local::timegm(0,0,0,1,0,1970);
> >
> > @data = split(/\n/, $data);
> >
> 
> Confirmed. Since today the test suite is failing. Proposed fix seems
> to work.

CPAN.pm users may use the following distroprefs file for automatic patching:
https://github.com/eserte/srezic-cpan-distroprefs/blob/master/TimeDate.yml

From dgood@willingminds.com on 2020-01-10 18:57:14 :

While it's true that the proposed fix allows the tests to succeed, it doesn't
fix the underlying bug. For example:

  # perl -MDate::Parse -e '$t = str2time("1970-01-01"); print "$t\n"; print
  gmtime($t) . "\n";'
  3155788800
  Wed Jan 1 08:00:00 2070

From https://bmwiedemann.zq1.de/ on 2020-01-11 04:07:36 :

Am Fr 10. Jan 2020, 13:57:14, dgood@willingminds.com schrieb:
> # perl -MDate::Parse -e '$t = str2time("1970-01-01"); print "$t\n";
> print
> gmtime($t) . "\n";'
> 3155788800
> Wed Jan 1 08:00:00 2070

indeed the tests were incomplete and did not catch this problem.

Attached a fix for this one and added test coverage.

From jgbaum@gmail.com on 2020-01-14 00:28:04 :

Any idea when a fix will be available via cpanm?  Or can you please provide instructions on how to apply the patch?

On Fri Jan 10 23:07:36 2020, https://bmwiedemann.zq1.de/ wrote:
> Am Fr 10. Jan 2020, 13:57:14, dgood@willingminds.com schrieb:
> > # perl -MDate::Parse -e '$t = str2time("1970-01-01"); print "$t\n";
> > print
> > gmtime($t) . "\n";'
> > 3155788800
> > Wed Jan 1 08:00:00 2070
> 
> indeed the tests were incomplete and did not catch this problem.
> 
> Attached a fix for this one and added test coverage.
atoomic commented 4 years ago

This is fixed by 4b67ccbdc1846620470ca524a5f3e2afd7b33f66