Skip Menu |

This queue is for tickets about the Business-Hours CPAN distribution.

Report information
The Basics
Id: 124551
Status: resolved
Priority: 0/
Queue: Business-Hours

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

Bug Information
Severity: Unimportant
Broken in: 0.12
Fixed in: (no value)



Subject: timelocal 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 (not tested)
Subject: fix.patch
Index: Business-Hours-0.12/lib/Business/Hours.pm =================================================================== --- Business-Hours-0.12.orig/lib/Business/Hours.pm +++ Business-Hours-0.12/lib/Business/Hours.pm @@ -273,7 +273,7 @@ sub for_timespan { # began. my @start = localtime( $args{'Start'} ); my $month = $start[4]; - my $year = $start[5]; + my $year = $start[5] + 1900; my $first_sunday = $start[3] - $start[6]; # period_start is time_t at midnight local time on the first sunday
Dne Pá 23.úno.2018 10:05:00, bmwiedemann napsal(a): Show quoted text
> 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 (not tested)
t/1-business-hours.t fails now (after 2019-01-01T00:00:00): $ perl -Ilib t/1-business-hours.t 1..17 ok 1 - use Business::Hours; ok 2 ok 3 not ok 4 # Failed test at t/1-business-hours.t line 16. # got: '0' # expected: '162000' ok 5 not ok 6 - Got seconds # Failed test 'Got seconds' # at t/1-business-hours.t line 24. not ok 7 # Failed test at t/1-business-hours.t line 27. # got: '0' # expected: '162000' not ok 8 # Failed test at t/1-business-hours.t line 50. # got: '374400' # expected: '28800' ok 9 ok 10 ok 11 ok 12 Set::IntSpan::_copy_run_list: Bad order 2: 72000--1 at lib/Business/Hours.pm line 270. # Looks like your test exited with 255 just after 12. There is a discussion at Time-Local issue tracker <https://github.com/houseabsolute/Time-Local/issues/8>.
We published a new version to CPAN with some fixes that should resolve the errors. Thanks for the bug reports! Jim