in reply to Re: Timelocal out of range message
in thread Timelocal out of range message

Here is the local.pm code snippet that says about out of range errors. Not sure how it's coming for day 29th?

croak "Month '$month' out of range 0..11" if $month > 11 || $month +< 0; croak "Day '$_[3]' out of range 1..31" if $_[3] > 31 || $_[3] + < 1; croak "Hour '$_[2]' out of range 0..23" if $_[2] > 23 || $_[2] + < 0; croak "Minute '$_[1]' out of range 0..59" if $_[1] > 59 || $_[1] + < 0; croak "Second '$_[0]' out of range 0..59" if $_[0] > 59 || $_[0] + < 0;

Replies are listed 'Best First'.
Re^3: Timelocal out of range message
by hdb (Monsignor) on Feb 03, 2014 at 07:40 UTC

    In the version I have it looks like:

    my @MonthDays = ( 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ); ... my $md = $MonthDays[$month]; ++$md if $month == 1 && _is_leap_year( $year + 1900 ); croak "Day '$mday' out of range 1..$md" if $mday > $md or $md +ay < 1; croak "Hour '$hour' out of range 0..23" if $hour > 23 or $ho +ur < 0; croak "Minute '$min' out of range 0..59" if $min > 59 or $mi +n < 0; croak "Second '$sec' out of range 0..59" if $sec >= 60 or $se +c < 0;