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

Report information
The Basics
Id:
113459
Status:
new
Priority:
Low/Low

People
Owner:
Nobody in particular
Requestors:
kevin.councilman [...] gmail.com
Cc:
AdminCc:

BugTracker
Severity:
(no value)
Broken in:
(no value)
Fixed in:
(no value)



Subject: Random failures for the add_seconds subroutine
Date: Wed, 30 Mar 2016 13:23:53 -0400
To: bug-Business-Hours@rt.cpan.org
From: Kevin Councilman <kevin.councilman@gmail.com>
Hello,

It appears that a call to the add_seconds sub routine will return -1 for various epoch start times depending on the defined start time of a business day. In the code example below, the returned value from a call to add_seconds is -1 if the defined start time is 09:30, however if the defined start time is changed to 09:00, the return value is 1461246399. I've tested this with perl v5.10, v5.16, and v5.22 along with various different versions of the Business::Hours, Set::IntSpan, and Time::Local modules with the same results being returned.


Show quoted text
#!/usr/bin/perl -w

use strict;
use Business::Hours;

#my $work_start = '09:00';
my $work_start = '09:30';
my $work_end = '17:30';

my %hours = (
            0 => { Name     => 'Sunday',
                   Start    => undef,
                   End      => undef },
            1 => { Name     => 'Monday',
                   Start    => $work_start,
                   End      => $work_end },
            2 => { Name     => 'Tuesday',
                   Start    => $work_start,
                   End      => $work_end },
            3 => { Name     => 'Wednesday',
                   Start    => $work_start,
                   End      => $work_end },
            4 => { Name     => 'Thursday',
                   Start    => $work_start,
                   End      => $work_end },
            5 => { Name     => 'Friday',
                   Start    => $work_start,
                   End      => $work_end },
            6 => { Name     => 'Saturday',
                   Start    => undef,
                   End      => undef }
);


my $hours = Business::Hours->new();
$hours->business_hours(%hours);

my $epoch = 1458750000;

my $dueTime = $hours->add_seconds($epoch, (172800 + 460599));
print "$dueTime\n";


This service runs on Request Tracker, is sponsored by The Perl Foundation, and maintained by Best Practical Solutions.

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