Filename | /usr/share/perl5/DateTime/TimeZone/OffsetOnly.pm |
Statements | Executed 24 statements in 1.16ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 729µs | 2.75ms | BEGIN@12 | DateTime::TimeZone::OffsetOnly::
1 | 1 | 1 | 541µs | 771µs | BEGIN@11 | DateTime::TimeZone::OffsetOnly::
1 | 1 | 1 | 28µs | 35µs | BEGIN@3 | DateTime::TimeZone::OffsetOnly::
1 | 1 | 1 | 18µs | 155µs | BEGIN@9 | DateTime::TimeZone::OffsetOnly::
1 | 1 | 1 | 16µs | 57µs | BEGIN@5 | DateTime::TimeZone::OffsetOnly::
4 | 2 | 1 | 10µs | 10µs | is_utc | DateTime::TimeZone::OffsetOnly::
1 | 1 | 1 | 10µs | 10µs | BEGIN@8 | 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 | 60µs | 2 | 42µs | # spent 35µs (28+7) within DateTime::TimeZone::OffsetOnly::BEGIN@3 which was called:
# once (28µs+7µs) by base::import at line 3 # spent 35µs making 1 call to DateTime::TimeZone::OffsetOnly::BEGIN@3
# spent 7µs making 1 call to strict::import |
4 | |||||
5 | 3 | 65µs | 2 | 99µs | # spent 57µs (16+42) within DateTime::TimeZone::OffsetOnly::BEGIN@5 which was called:
# once (16µs+42µs) by base::import at line 5 # spent 57µs making 1 call to DateTime::TimeZone::OffsetOnly::BEGIN@5
# spent 42µs making 1 call to vars::import |
6 | 1 | 1µs | $VERSION = 0.02; | ||
7 | |||||
8 | 3 | 50µs | 1 | 10µs | # spent 10µs within DateTime::TimeZone::OffsetOnly::BEGIN@8 which was called:
# once (10µs+0s) by base::import at line 8 # spent 10µs making 1 call to DateTime::TimeZone::OffsetOnly::BEGIN@8 |
9 | 3 | 77µs | 2 | 155µs | # spent 155µs (18+138) within DateTime::TimeZone::OffsetOnly::BEGIN@9 which was called:
# once (18µs+138µs) by base::import at line 9 # spent 155µs making 1 call to DateTime::TimeZone::OffsetOnly::BEGIN@9
# spent 138µs making 1 call to base::import, recursion: max depth 1, sum of overlapping time 138µs |
10 | |||||
11 | 3 | 201µs | 1 | 771µs | # spent 771µs (541+229) within DateTime::TimeZone::OffsetOnly::BEGIN@11 which was called:
# once (541µs+229µs) by base::import at line 11 # spent 771µs making 1 call to DateTime::TimeZone::OffsetOnly::BEGIN@11 |
12 | 3 | 670µs | 2 | 2.94ms | # spent 2.75ms (729µs+2.03) within DateTime::TimeZone::OffsetOnly::BEGIN@12 which was called:
# once (729µs+2.03ms) by base::import at line 12 # spent 2.75ms making 1 call to DateTime::TimeZone::OffsetOnly::BEGIN@12
# spent 190µ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 | 24µs | # spent 10µs within DateTime::TimeZone::OffsetOnly::is_utc which was called 4 times, avg 3µs/call:
# 2 times (6µs+0s) by DateTime::_calc_utc_rd at line 343 of DateTime.pm, avg 3µs/call
# 2 times (5µs+0s) by DateTime::_calc_local_rd at line 384 of DateTime.pm, avg 2µ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 | 7µs | 1; | ||
74 | |||||
75 | __END__ |