Filename | /usr/local/share/perl/5.14.2/DateTime/TimeZone/OlsonDB/Rule.pm |
Statements | Executed 16 statements in 557µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 9µs | 9µs | BEGIN@5 | DateTime::TimeZone::OlsonDB::Rule::
1 | 1 | 1 | 9µs | 43µs | BEGIN@16 | DateTime::TimeZone::OlsonDB::Rule::
1 | 1 | 1 | 9µs | 9µs | BEGIN@13 | DateTime::TimeZone::OlsonDB::Rule::
1 | 1 | 1 | 7µs | 7µs | BEGIN@14 | DateTime::TimeZone::OlsonDB::Rule::
1 | 1 | 1 | 7µs | 12µs | BEGIN@10 | DateTime::TimeZone::OlsonDB::Rule::
1 | 1 | 1 | 7µs | 9µs | BEGIN@9 | DateTime::TimeZone::OlsonDB::Rule::
1 | 1 | 1 | 5µs | 5µs | BEGIN@12 | DateTime::TimeZone::OlsonDB::Rule::
0 | 0 | 0 | 0s | 0s | at | DateTime::TimeZone::OlsonDB::Rule::
0 | 0 | 0 | 0s | 0s | is_infinite | DateTime::TimeZone::OlsonDB::Rule::
0 | 0 | 0 | 0s | 0s | letter | DateTime::TimeZone::OlsonDB::Rule::
0 | 0 | 0 | 0s | 0s | max_year | DateTime::TimeZone::OlsonDB::Rule::
0 | 0 | 0 | 0s | 0s | min_year | DateTime::TimeZone::OlsonDB::Rule::
0 | 0 | 0 | 0s | 0s | month | DateTime::TimeZone::OlsonDB::Rule::
0 | 0 | 0 | 0s | 0s | name | DateTime::TimeZone::OlsonDB::Rule::
0 | 0 | 0 | 0s | 0s | new | DateTime::TimeZone::OlsonDB::Rule::
0 | 0 | 0 | 0s | 0s | offset_from_std | DateTime::TimeZone::OlsonDB::Rule::
0 | 0 | 0 | 0s | 0s | on | DateTime::TimeZone::OlsonDB::Rule::
0 | 0 | 0 | 0s | 0s | utc_start_datetime_for_year | DateTime::TimeZone::OlsonDB::Rule::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package DateTime::TimeZone::OlsonDB::Rule; | ||||
2 | { | ||||
3 | 2 | 1µs | $DateTime::TimeZone::OlsonDB::Rule::VERSION = '1.63'; | ||
4 | } | ||||
5 | # spent 9µs within DateTime::TimeZone::OlsonDB::Rule::BEGIN@5 which was called:
# once (9µs+0s) by DateTime::TimeZone::OlsonDB::BEGIN@14 at line 7 | ||||
6 | 1 | 7µs | $DateTime::TimeZone::OlsonDB::Rule::AUTHORITY = 'cpan:DROLSKY'; | ||
7 | 1 | 19µs | 1 | 9µs | } # spent 9µs making 1 call to DateTime::TimeZone::OlsonDB::Rule::BEGIN@5 |
8 | |||||
9 | 2 | 20µs | 2 | 12µs | # spent 9µs (7+3) within DateTime::TimeZone::OlsonDB::Rule::BEGIN@9 which was called:
# once (7µs+3µs) by DateTime::TimeZone::OlsonDB::BEGIN@14 at line 9 # spent 9µs making 1 call to DateTime::TimeZone::OlsonDB::Rule::BEGIN@9
# spent 3µs making 1 call to strict::import |
10 | 2 | 20µs | 2 | 16µs | # spent 12µs (7+5) within DateTime::TimeZone::OlsonDB::Rule::BEGIN@10 which was called:
# once (7µs+5µs) by DateTime::TimeZone::OlsonDB::BEGIN@14 at line 10 # spent 12µs making 1 call to DateTime::TimeZone::OlsonDB::Rule::BEGIN@10
# spent 5µs making 1 call to warnings::import |
11 | |||||
12 | 2 | 24µs | 1 | 5µs | # spent 5µs within DateTime::TimeZone::OlsonDB::Rule::BEGIN@12 which was called:
# once (5µs+0s) by DateTime::TimeZone::OlsonDB::BEGIN@14 at line 12 # spent 5µs making 1 call to DateTime::TimeZone::OlsonDB::Rule::BEGIN@12 |
13 | 2 | 22µs | 1 | 9µs | # spent 9µs within DateTime::TimeZone::OlsonDB::Rule::BEGIN@13 which was called:
# once (9µs+0s) by DateTime::TimeZone::OlsonDB::BEGIN@14 at line 13 # spent 9µs making 1 call to DateTime::TimeZone::OlsonDB::Rule::BEGIN@13 |
14 | 2 | 30µs | 1 | 7µs | # spent 7µs within DateTime::TimeZone::OlsonDB::Rule::BEGIN@14 which was called:
# once (7µs+0s) by DateTime::TimeZone::OlsonDB::BEGIN@14 at line 14 # spent 7µs making 1 call to DateTime::TimeZone::OlsonDB::Rule::BEGIN@14 |
15 | |||||
16 | 2 | 411µs | 2 | 77µs | # spent 43µs (9+34) within DateTime::TimeZone::OlsonDB::Rule::BEGIN@16 which was called:
# once (9µs+34µs) by DateTime::TimeZone::OlsonDB::BEGIN@14 at line 16 # spent 43µs making 1 call to DateTime::TimeZone::OlsonDB::Rule::BEGIN@16
# spent 34µs making 1 call to Exporter::import |
17 | |||||
18 | sub new { | ||||
19 | my $class = shift; | ||||
20 | my %p = validate( | ||||
21 | @_, { | ||||
22 | name => { type => SCALAR }, | ||||
23 | from => { type => SCALAR }, | ||||
24 | to => { type => SCALAR }, | ||||
25 | type => { type => SCALAR, default => undef }, | ||||
26 | in => { type => SCALAR }, | ||||
27 | on => { type => SCALAR }, | ||||
28 | at => { type => SCALAR }, | ||||
29 | save => { type => SCALAR }, | ||||
30 | letter => { type => SCALAR, default => '' }, | ||||
31 | }, | ||||
32 | ); | ||||
33 | |||||
34 | my $save = $p{save}; | ||||
35 | |||||
36 | # The handling of q{-} and q{1} are to account for new syntax introduced | ||||
37 | # in 2009u (and hopefully gone in future versions). | ||||
38 | if ( $save && $save ne q{-} ) { | ||||
39 | if ( $save =~ /^\d+$/ ) { | ||||
40 | $p{offset_from_std} = 3600 * $save; | ||||
41 | } | ||||
42 | else { | ||||
43 | $p{offset_from_std} | ||||
44 | = DateTime::TimeZone::offset_as_seconds($save); | ||||
45 | } | ||||
46 | } | ||||
47 | else { | ||||
48 | $p{offset_from_std} = 0; | ||||
49 | } | ||||
50 | |||||
51 | return bless \%p, $class; | ||||
52 | } | ||||
53 | |||||
54 | sub name { $_[0]->{name} } | ||||
55 | sub offset_from_std { $_[0]->{offset_from_std} } | ||||
56 | sub letter { $_[0]->{letter} } | ||||
57 | sub min_year { $_[0]->{from} } | ||||
58 | |||||
59 | sub max_year { | ||||
60 | $_[0]->{to} eq 'only' ? $_[0]->min_year | ||||
61 | : $_[0]->{to} eq 'max' ? undef | ||||
62 | : $_[0]->{to}; | ||||
63 | } | ||||
64 | |||||
65 | sub is_infinite { $_[0]->{to} eq 'max' ? 1 : 0 } | ||||
66 | |||||
67 | sub month { $DateTime::TimeZone::OlsonDB::MONTHS{ $_[0]->{in} } } | ||||
68 | sub on { $_[0]->{on} } | ||||
69 | sub at { $_[0]->{at} } | ||||
70 | |||||
71 | sub utc_start_datetime_for_year { | ||||
72 | my $self = shift; | ||||
73 | my $year = shift; | ||||
74 | my $offset_from_utc = shift; | ||||
75 | |||||
76 | # should be the offset of the _previous_ rule | ||||
77 | my $offset_from_std = shift; | ||||
78 | |||||
79 | my $day = DateTime::TimeZone::OlsonDB::parse_day_spec( $self->on, | ||||
80 | $self->month, $year ); | ||||
81 | |||||
82 | my $utc = DateTime::TimeZone::OlsonDB::utc_datetime_for_time_spec( | ||||
83 | spec => $self->at, | ||||
84 | year => $year, | ||||
85 | month => $self->month, | ||||
86 | day => $day, | ||||
87 | offset_from_utc => $offset_from_utc, | ||||
88 | offset_from_std => $offset_from_std, | ||||
89 | ); | ||||
90 | |||||
91 | return $utc; | ||||
92 | } | ||||
93 | |||||
94 | 1 | 3µs | 1; |