Filename | /usr/share/perl5/DateTime/TimeZone/OffsetOnly.pm |
Statements | Executed 16 statements in 2.04ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 1.14ms | 12.0ms | BEGIN@9 | DateTime::TimeZone::OffsetOnly::
1 | 1 | 1 | 916µs | 988µs | BEGIN@8 | DateTime::TimeZone::OffsetOnly::
1 | 1 | 1 | 12µs | 24µs | BEGIN@3 | DateTime::TimeZone::OffsetOnly::
1 | 1 | 1 | 7µs | 11µs | BEGIN@4 | DateTime::TimeZone::OffsetOnly::
1 | 1 | 1 | 6µs | 33µs | BEGIN@6 | DateTime::TimeZone::OffsetOnly::
4 | 2 | 1 | 3µs | 3µ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 | 1 | 500ns | $DateTime::TimeZone::OffsetOnly::VERSION = '1.75'; | ||
3 | 2 | 24µs | 2 | 35µs | # spent 24µs (12+12) within DateTime::TimeZone::OffsetOnly::BEGIN@3 which was called:
# once (12µs+12µs) by parent::import at line 3 # spent 24µs making 1 call to DateTime::TimeZone::OffsetOnly::BEGIN@3
# spent 12µs making 1 call to strict::import |
4 | 2 | 23µs | 2 | 16µs | # spent 11µs (7+4) within DateTime::TimeZone::OffsetOnly::BEGIN@4 which was called:
# once (7µs+4µs) by parent::import at line 4 # spent 11µs making 1 call to DateTime::TimeZone::OffsetOnly::BEGIN@4
# spent 4µs making 1 call to warnings::import |
5 | |||||
6 | 2 | 28µs | 2 | 33µs | # spent 33µs (6+27) within DateTime::TimeZone::OffsetOnly::BEGIN@6 which was called:
# once (6µs+27µs) by parent::import at line 6 # spent 33µs making 1 call to DateTime::TimeZone::OffsetOnly::BEGIN@6
# spent 27µs making 1 call to parent::import, recursion: max depth 1, sum of overlapping time 27µs |
7 | |||||
8 | 2 | 782µs | 1 | 988µs | # spent 988µs (916+73) within DateTime::TimeZone::OffsetOnly::BEGIN@8 which was called:
# once (916µs+73µs) by parent::import at line 8 # spent 988µs making 1 call to DateTime::TimeZone::OffsetOnly::BEGIN@8 |
9 | 2 | 1.17ms | 2 | 12.1ms | # spent 12.0ms (1.14+10.9) within DateTime::TimeZone::OffsetOnly::BEGIN@9 which was called:
# once (1.14ms+10.9ms) by parent::import at line 9 # spent 12.0ms making 1 call to DateTime::TimeZone::OffsetOnly::BEGIN@9
# spent 53µs making 1 call to Exporter::import |
10 | |||||
11 | sub new { | ||||
12 | my $class = shift; | ||||
13 | my %p = validate( | ||||
14 | @_, { | ||||
15 | offset => { type => SCALAR }, | ||||
16 | } | ||||
17 | ); | ||||
18 | |||||
19 | my $offset = DateTime::TimeZone::offset_as_seconds( $p{offset} ); | ||||
20 | |||||
21 | die "Invalid offset: $p{offset}\n" unless defined $offset; | ||||
22 | |||||
23 | return DateTime::TimeZone::UTC->new unless $offset; | ||||
24 | |||||
25 | my $self = { | ||||
26 | name => DateTime::TimeZone::offset_as_string($offset), | ||||
27 | offset => $offset, | ||||
28 | }; | ||||
29 | |||||
30 | return bless $self, $class; | ||||
31 | } | ||||
32 | |||||
33 | sub is_dst_for_datetime {0} | ||||
34 | |||||
35 | sub offset_for_datetime { $_[0]->{offset} } | ||||
36 | sub offset_for_local_datetime { $_[0]->{offset} } | ||||
37 | |||||
38 | 4 | 8µs | # spent 3µs within DateTime::TimeZone::OffsetOnly::is_utc which was called 4 times, avg 700ns/call:
# 2 times (2µs+0s) by DateTime::_calc_utc_rd at line 389 of DateTime.pm, avg 950ns/call
# 2 times (900ns+0s) by DateTime::_calc_local_rd at line 436 of DateTime.pm, avg 450ns/call | ||
39 | |||||
40 | sub short_name_for_datetime { $_[0]->name } | ||||
41 | |||||
42 | sub category {undef} | ||||
43 | |||||
44 | sub STORABLE_freeze { | ||||
45 | my $self = shift; | ||||
46 | |||||
47 | return $self->name; | ||||
48 | } | ||||
49 | |||||
50 | sub STORABLE_thaw { | ||||
51 | my $self = shift; | ||||
52 | my $cloning = shift; | ||||
53 | my $serialized = shift; | ||||
54 | |||||
55 | my $class = ref $self || $self; | ||||
56 | |||||
57 | my $obj; | ||||
58 | if ( $class->isa(__PACKAGE__) ) { | ||||
59 | $obj = __PACKAGE__->new( offset => $serialized ); | ||||
60 | } | ||||
61 | else { | ||||
62 | $obj = $class->new( offset => $serialized ); | ||||
63 | } | ||||
64 | |||||
65 | %$self = %$obj; | ||||
66 | |||||
67 | return $self; | ||||
68 | } | ||||
69 | |||||
70 | 1 | 2µs | 1; | ||
71 | |||||
72 | # ABSTRACT: A DateTime::TimeZone object that just contains an offset | ||||
73 | |||||
74 | __END__ |