Filename | /usr/local/share/perl/5.14.2/DateTime/TimeZone/OlsonDB/Rule.pm |
Statements | Executed 16 statements in 1.25ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 19µs | 19µs | BEGIN@5 | DateTime::TimeZone::OlsonDB::Rule::
1 | 1 | 1 | 18µs | 18µs | BEGIN@13 | DateTime::TimeZone::OlsonDB::Rule::
1 | 1 | 1 | 18µs | 18µs | BEGIN@14 | DateTime::TimeZone::OlsonDB::Rule::
1 | 1 | 1 | 17µs | 90µs | BEGIN@16 | DateTime::TimeZone::OlsonDB::Rule::
1 | 1 | 1 | 15µs | 21µs | BEGIN@9 | DateTime::TimeZone::OlsonDB::Rule::
1 | 1 | 1 | 14µs | 25µs | BEGIN@10 | DateTime::TimeZone::OlsonDB::Rule::
1 | 1 | 1 | 12µs | 12µ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 | 3µs | $DateTime::TimeZone::OlsonDB::Rule::VERSION = '1.63'; | ||
4 | } | ||||
5 | # spent 19µs within DateTime::TimeZone::OlsonDB::Rule::BEGIN@5 which was called:
# once (19µs+0s) by DateTime::TimeZone::OlsonDB::BEGIN@14 at line 7 | ||||
6 | 1 | 11µs | $DateTime::TimeZone::OlsonDB::Rule::AUTHORITY = 'cpan:DROLSKY'; | ||
7 | 1 | 43µs | 1 | 19µs | } # spent 19µs making 1 call to DateTime::TimeZone::OlsonDB::Rule::BEGIN@5 |
8 | |||||
9 | 2 | 47µs | 2 | 28µs | # spent 21µs (15+6) within DateTime::TimeZone::OlsonDB::Rule::BEGIN@9 which was called:
# once (15µs+6µs) by DateTime::TimeZone::OlsonDB::BEGIN@14 at line 9 # spent 21µs making 1 call to DateTime::TimeZone::OlsonDB::Rule::BEGIN@9
# spent 6µs making 1 call to strict::import |
10 | 2 | 46µs | 2 | 36µs | # spent 25µs (14+11) within DateTime::TimeZone::OlsonDB::Rule::BEGIN@10 which was called:
# once (14µs+11µs) by DateTime::TimeZone::OlsonDB::BEGIN@14 at line 10 # spent 25µs making 1 call to DateTime::TimeZone::OlsonDB::Rule::BEGIN@10
# spent 11µs making 1 call to warnings::import |
11 | |||||
12 | 2 | 55µs | 1 | 12µs | # spent 12µs within DateTime::TimeZone::OlsonDB::Rule::BEGIN@12 which was called:
# once (12µs+0s) by DateTime::TimeZone::OlsonDB::BEGIN@14 at line 12 # spent 12µs making 1 call to DateTime::TimeZone::OlsonDB::Rule::BEGIN@12 |
13 | 2 | 56µs | 1 | 18µs | # spent 18µs within DateTime::TimeZone::OlsonDB::Rule::BEGIN@13 which was called:
# once (18µs+0s) by DateTime::TimeZone::OlsonDB::BEGIN@14 at line 13 # spent 18µs making 1 call to DateTime::TimeZone::OlsonDB::Rule::BEGIN@13 |
14 | 2 | 64µs | 1 | 18µs | # spent 18µs within DateTime::TimeZone::OlsonDB::Rule::BEGIN@14 which was called:
# once (18µs+0s) by DateTime::TimeZone::OlsonDB::BEGIN@14 at line 14 # spent 18µs making 1 call to DateTime::TimeZone::OlsonDB::Rule::BEGIN@14 |
15 | |||||
16 | 2 | 924µs | 2 | 163µs | # spent 90µs (17+73) within DateTime::TimeZone::OlsonDB::Rule::BEGIN@16 which was called:
# once (17µs+73µs) by DateTime::TimeZone::OlsonDB::BEGIN@14 at line 16 # spent 90µs making 1 call to DateTime::TimeZone::OlsonDB::Rule::BEGIN@16
# spent 73µ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 | 6µs | 1; |