Skip to content

Commit 9e06a81

Browse files
bingoskhwilliamson
authored andcommitted
Update Time-Local to CPAN version 1.25
[DELTA] 1.25 2016-11-17 - Reduce memory usage by only loading Config if needed and not importing from Carp. Based on PR #2 from J. Nick Coston.
1 parent a98d8c5 commit 9e06a81

File tree

2 files changed

+41
-20
lines changed

2 files changed

+41
-20
lines changed

Porting/Maintainers.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1293,7 +1293,7 @@ package Maintainers;
12931293
},
12941294

12951295
'Time::Local' => {
1296-
'DISTRIBUTION' => 'DROLSKY/Time-Local-1.24.tar.gz',
1296+
'DISTRIBUTION' => 'DROLSKY/Time-Local-1.25.tar.gz',
12971297
'FILES' => q[cpan/Time-Local],
12981298
'EXCLUDED' => [
12991299
qr{^xt/},

cpan/Time-Local/lib/Time/Local.pm

Lines changed: 40 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@ package Time::Local;
22

33
use strict;
44

5-
use Carp;
6-
use Config;
5+
use Carp ();
76
use Exporter;
87

9-
our $VERSION = '1.24';
8+
our $VERSION = '1.25';
109

1110
use parent 'Exporter';
1211

@@ -31,14 +30,20 @@ use constant SECS_PER_DAY => 86400;
3130

3231
my $MaxDay;
3332
if ( $] < 5.012000 ) {
33+
require Config;
34+
## no critic (Variables::ProhibitPackageVars)
35+
3436
my $MaxInt;
3537
if ( $^O eq 'MacOS' ) {
3638

3739
# time_t is unsigned...
38-
$MaxInt = ( 1 << ( 8 * $Config{ivsize} ) ) - 1;
40+
$MaxInt = ( 1 << ( 8 * $Config::Config{ivsize} ) )
41+
- 1; ## no critic qw(ProhibitPackageVars)
3942
}
4043
else {
41-
$MaxInt = ( ( 1 << ( 8 * $Config{ivsize} - 2 ) ) - 1 ) * 2 + 1;
44+
$MaxInt
45+
= ( ( 1 << ( 8 * $Config::Config{ivsize} - 2 ) ) - 1 ) * 2
46+
+ 1; ## no critic qw(ProhibitPackageVars)
4247
}
4348

4449
$MaxDay = int( ( $MaxInt - ( SECS_PER_DAY / 2 ) ) / SECS_PER_DAY ) - 1;
@@ -83,8 +88,7 @@ sub _daygm {
8388
+ int( $year / 4 )
8489
- int( $year / 100 )
8590
+ int( $year / 400 )
86-
+ int( ( ( $month * 306 ) + 5 ) / 10 ) )
87-
- $Epoc;
91+
+ int( ( ( $month * 306 ) + 5 ) / 10 ) ) - $Epoc;
8892
}
8993
);
9094
}
@@ -109,18 +113,22 @@ sub timegm {
109113
}
110114

111115
unless ( $Options{no_range_check} ) {
112-
croak "Month '$month' out of range 0..11"
116+
Carp::croak("Month '$month' out of range 0..11")
113117
if $month > 11
114118
or $month < 0;
115119

116120
my $md = $MonthDays[$month];
117121
++$md
118122
if $month == 1 && _is_leap_year( $year + 1900 );
119123

120-
croak "Day '$mday' out of range 1..$md" if $mday > $md or $mday < 1;
121-
croak "Hour '$hour' out of range 0..23" if $hour > 23 or $hour < 0;
122-
croak "Minute '$min' out of range 0..59" if $min > 59 or $min < 0;
123-
croak "Second '$sec' out of range 0..59" if $sec >= 60 or $sec < 0;
124+
Carp::croak("Day '$mday' out of range 1..$md")
125+
if $mday > $md or $mday < 1;
126+
Carp::croak("Hour '$hour' out of range 0..23")
127+
if $hour > 23 or $hour < 0;
128+
Carp::croak("Minute '$min' out of range 0..59")
129+
if $min > 59 or $min < 0;
130+
Carp::croak("Second '$sec' out of range 0..59")
131+
if $sec >= 60 or $sec < 0;
124132
}
125133

126134
my $days = _daygm( undef, undef, undef, $mday, $month, $year );
@@ -133,7 +141,7 @@ sub timegm {
133141
$msg
134142
.= "Cannot handle date ($sec, $min, $hour, $mday, $month, $year)";
135143

136-
croak $msg;
144+
Carp::croak($msg);
137145
}
138146

139147
return
@@ -214,7 +222,7 @@ Time::Local - Efficiently compute time from local and GMT time
214222
215223
=head1 VERSION
216224
217-
version 1.24
225+
version 1.25
218226
219227
=head1 SYNOPSIS
220228
@@ -370,24 +378,37 @@ The current version was written by Graham Barr.
370378
371379
The whole scheme for interpreting two-digit years can be considered a bug.
372380
373-
Bugs may be submitted through L<the RT bug tracker|http://rt.cpan.org/Public/Dist/Display.html?Name=Time-Local>
374-
381+
Bugs may be submitted through L<https://github.com/houseabsolute/Time-Local/issues>.
375382
376383
There is a mailing list available for users of this distribution,
377384
378385
379-
I am also usually active on IRC as 'drolsky' on C<irc://irc.perl.org>.
386+
I am also usually active on IRC as 'autarch' on C<irc://irc.perl.org>.
380387
381388
=head1 AUTHOR
382389
383390
Dave Rolsky <[email protected]>
384391
385-
=head1 CONTRIBUTOR
392+
=head1 CONTRIBUTORS
393+
394+
=for stopwords Florian Ragwitz J. Nick Koston Unknown
386395
387-
=for stopwords Florian Ragwitz
396+
=over 4
397+
398+
=item *
388399
389400
Florian Ragwitz <[email protected]>
390401
402+
=item *
403+
404+
J. Nick Koston <[email protected]>
405+
406+
=item *
407+
408+
409+
410+
=back
411+
391412
=head1 COPYRIGHT AND LICENSE
392413
393414
This software is copyright (c) 1997 - 2016 by Graham Barr & Dave Rolsky.

0 commit comments

Comments
 (0)