Filename | /usr/share/perl5/DateTime/TimeZone/OffsetOnly.pm |
Statements | Executed 24 statements in 756µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 442µs | 1.74ms | BEGIN@12 | DateTime::TimeZone::OffsetOnly::
1 | 1 | 1 | 354µs | 521µs | BEGIN@11 | DateTime::TimeZone::OffsetOnly::
1 | 1 | 1 | 32µs | 39µs | BEGIN@3 | DateTime::TimeZone::OffsetOnly::
1 | 1 | 1 | 10µs | 36µs | BEGIN@5 | DateTime::TimeZone::OffsetOnly::
1 | 1 | 1 | 10µs | 84µs | BEGIN@9 | DateTime::TimeZone::OffsetOnly::
1 | 1 | 1 | 6µs | 6µs | BEGIN@8 | DateTime::TimeZone::OffsetOnly::
4 | 2 | 1 | 6µs | 6µs | is_utc | DateTime::TimeZone::OffsetOnly::
0 | 0 | 0 | 0s | 0s | STORABLE_freeze | DateTime::TimeZone::OffsetOnly::
0 | 0 | 0 | 0s | 0s | STORABLE_thaw | DateTime::TimeZone::OffsetOnly::
0 | 0 | 0 | 0s | 0s | category | DateTime::TimeZone::OffsetOnly::
0 | 0 | 0 | 0s | 0s | is_dst_for_datetime | DateTime::TimeZone::OffsetOnly::
0 | 0 | 0 | 0s | 0s | new | DateTime::TimeZone::OffsetOnly::
0 | 0 | 0 | 0s | 0s | offset_for_datetime | DateTime::TimeZone::OffsetOnly::
0 | 0 | 0 | 0s | 0s | offset_for_local_datetime | DateTime::TimeZone::OffsetOnly::
0 | 0 | 0 | 0s | 0s | short_name_for_datetime | DateTime::TimeZone::OffsetOnly::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package DateTime::TimeZone::OffsetOnly; | ||||
2 | |||||
3 | 3 | 42µs | 2 | 46µs | # spent 39µs (32+7) within DateTime::TimeZone::OffsetOnly::BEGIN@3 which was called:
# once (32µs+7µs) by base::import at line 3 # spent 39µs making 1 call to DateTime::TimeZone::OffsetOnly::BEGIN@3
# spent 7µs making 1 call to strict::import |
4 | |||||
5 | 3 | 37µs | 2 | 62µs | # spent 36µs (10+26) within DateTime::TimeZone::OffsetOnly::BEGIN@5 which was called:
# once (10µs+26µs) by base::import at line 5 # spent 36µs making 1 call to DateTime::TimeZone::OffsetOnly::BEGIN@5
# spent 26µs making 1 call to vars::import |
6 | 1 | 800ns | $VERSION = 0.02; | ||
7 | |||||
8 | 3 | 27µs | 1 | 6µs | # spent 6µs within DateTime::TimeZone::OffsetOnly::BEGIN@8 which was called:
# once (6µs+0s) by base::import at line 8 # spent 6µs making 1 call to DateTime::TimeZone::OffsetOnly::BEGIN@8 |
9 | 3 | 41µs | 2 | 84µs | # spent 84µs (10+75) within DateTime::TimeZone::OffsetOnly::BEGIN@9 which was called:
# once (10µs+75µs) by base::import at line 9 # spent 84µs making 1 call to DateTime::TimeZone::OffsetOnly::BEGIN@9
# spent 75µs making 1 call to base::import, recursion: max depth 1, sum of overlapping time 75µs |
10 | |||||
11 | 3 | 152µs | 1 | 521µs | # spent 521µs (354+166) within DateTime::TimeZone::OffsetOnly::BEGIN@11 which was called:
# once (354µs+166µs) by base::import at line 11 # spent 521µs making 1 call to DateTime::TimeZone::OffsetOnly::BEGIN@11 |
12 | 3 | 436µs | 2 | 1.85ms | # spent 1.74ms (442µs+1.30) within DateTime::TimeZone::OffsetOnly::BEGIN@12 which was called:
# once (442µs+1.30ms) by base::import at line 12 # spent 1.74ms making 1 call to DateTime::TimeZone::OffsetOnly::BEGIN@12
# spent 104µs making 1 call to Exporter::import |
13 | |||||
14 | sub new { | ||||
15 | my $class = shift; | ||||
16 | my %p = validate( | ||||
17 | @_, { | ||||
18 | offset => { type => SCALAR }, | ||||
19 | } | ||||
20 | ); | ||||
21 | |||||
22 | my $offset = DateTime::TimeZone::offset_as_seconds( $p{offset} ); | ||||
23 | |||||
24 | die "Invalid offset: $p{offset}\n" unless defined $offset; | ||||
25 | |||||
26 | return DateTime::TimeZone::UTC->new unless $offset; | ||||
27 | |||||
28 | my $self = { | ||||
29 | name => DateTime::TimeZone::offset_as_string($offset), | ||||
30 | offset => $offset, | ||||
31 | }; | ||||
32 | |||||
33 | return bless $self, $class; | ||||
34 | } | ||||
35 | |||||
36 | sub is_dst_for_datetime {0} | ||||
37 | |||||
38 | sub offset_for_datetime { $_[0]->{offset} } | ||||
39 | sub offset_for_local_datetime { $_[0]->{offset} } | ||||
40 | |||||
41 | 4 | 16µs | # spent 6µs within DateTime::TimeZone::OffsetOnly::is_utc which was called 4 times, avg 2µs/call:
# 2 times (4µs+0s) by DateTime::_calc_utc_rd at line 343 of DateTime.pm, avg 2µs/call
# 2 times (2µs+0s) by DateTime::_calc_local_rd at line 384 of DateTime.pm, avg 1µs/call | ||
42 | |||||
43 | sub short_name_for_datetime { $_[0]->name } | ||||
44 | |||||
45 | sub category {undef} | ||||
46 | |||||
47 | sub STORABLE_freeze { | ||||
48 | my $self = shift; | ||||
49 | |||||
50 | return $self->name; | ||||
51 | } | ||||
52 | |||||
53 | sub STORABLE_thaw { | ||||
54 | my $self = shift; | ||||
55 | my $cloning = shift; | ||||
56 | my $serialized = shift; | ||||
57 | |||||
58 | my $class = ref $self || $self; | ||||
59 | |||||
60 | my $obj; | ||||
61 | if ( $class->isa(__PACKAGE__) ) { | ||||
62 | $obj = __PACKAGE__->new( offset => $serialized ); | ||||
63 | } | ||||
64 | else { | ||||
65 | $obj = $class->new( offset => $serialized ); | ||||
66 | } | ||||
67 | |||||
68 | %$self = %$obj; | ||||
69 | |||||
70 | return $self; | ||||
71 | } | ||||
72 | |||||
73 | 1 | 3µs | 1; | ||
74 | |||||
75 | __END__ |