Filename | /usr/local/share/perl/5.14.2/DateTime/TimeZone/Local.pm |
Statements | Executed 37 statements in 627µs |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 1.58ms | 1.69ms | BEGIN@14 | DateTime::TimeZone::Local::
1 | 1 | 1 | 1.13ms | 6.00ms | BEGIN@12 | DateTime::TimeZone::Local::
1 | 1 | 1 | 21µs | 57.5ms | TimeZone | DateTime::TimeZone::Local::
1 | 1 | 1 | 20µs | 4.81ms | _load_subclass | DateTime::TimeZone::Local::
1 | 1 | 1 | 11µs | 14µs | FromEnv | DateTime::TimeZone::Local::
1 | 1 | 1 | 8µs | 8µs | BEGIN@5 | DateTime::TimeZone::Local::
1 | 1 | 1 | 7µs | 7µs | BEGIN@13 | DateTime::TimeZone::Local::
1 | 1 | 1 | 7µs | 9µs | BEGIN@9 | DateTime::TimeZone::Local::
1 | 1 | 1 | 6µs | 11µs | BEGIN@10 | DateTime::TimeZone::Local::
1 | 1 | 1 | 2µs | 2µs | _IsValidName | DateTime::TimeZone::Local::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package DateTime::TimeZone::Local; | ||||
2 | { | ||||
3 | 2 | 1µs | $DateTime::TimeZone::Local::VERSION = '1.63'; | ||
4 | } | ||||
5 | # spent 8µs within DateTime::TimeZone::Local::BEGIN@5 which was called:
# once (8µs+0s) by DateTime::TimeZone::BEGIN@16 at line 7 | ||||
6 | 1 | 5µs | $DateTime::TimeZone::Local::AUTHORITY = 'cpan:DROLSKY'; | ||
7 | 1 | 18µs | 1 | 8µs | } # spent 8µs making 1 call to DateTime::TimeZone::Local::BEGIN@5 |
8 | |||||
9 | 2 | 20µs | 2 | 12µs | # spent 9µs (7+3) within DateTime::TimeZone::Local::BEGIN@9 which was called:
# once (7µs+3µs) by DateTime::TimeZone::BEGIN@16 at line 9 # spent 9µs making 1 call to DateTime::TimeZone::Local::BEGIN@9
# spent 3µs making 1 call to strict::import |
10 | 2 | 24µs | 2 | 16µs | # spent 11µs (6+5) within DateTime::TimeZone::Local::BEGIN@10 which was called:
# once (6µs+5µs) by DateTime::TimeZone::BEGIN@16 at line 10 # spent 11µs making 1 call to DateTime::TimeZone::Local::BEGIN@10
# spent 5µs making 1 call to warnings::import |
11 | |||||
12 | 2 | 100µs | 2 | 6.05ms | # spent 6.00ms (1.13+4.87) within DateTime::TimeZone::Local::BEGIN@12 which was called:
# once (1.13ms+4.87ms) by DateTime::TimeZone::BEGIN@16 at line 12 # spent 6.00ms making 1 call to DateTime::TimeZone::Local::BEGIN@12
# spent 44µs making 1 call to Exporter::import |
13 | 2 | 24µs | 1 | 7µs | # spent 7µs within DateTime::TimeZone::Local::BEGIN@13 which was called:
# once (7µs+0s) by DateTime::TimeZone::BEGIN@16 at line 13 # spent 7µs making 1 call to DateTime::TimeZone::Local::BEGIN@13 |
14 | 2 | 373µs | 1 | 1.69ms | # spent 1.69ms (1.58+112µs) within DateTime::TimeZone::Local::BEGIN@14 which was called:
# once (1.58ms+112µs) by DateTime::TimeZone::BEGIN@16 at line 14 # spent 1.69ms making 1 call to DateTime::TimeZone::Local::BEGIN@14 |
15 | |||||
16 | # spent 57.5ms (21µs+57.5) within DateTime::TimeZone::Local::TimeZone which was called:
# once (21µs+57.5ms) by DateTime::TimeZone::new at line 57 of DateTime/TimeZone.pm | ||||
17 | 7 | 16µs | my $class = shift; | ||
18 | |||||
19 | 1 | 4.81ms | my $subclass = $class->_load_subclass(); # spent 4.81ms making 1 call to DateTime::TimeZone::Local::_load_subclass | ||
20 | |||||
21 | 1 | 2µs | for my $meth ( $subclass->Methods() ) { # spent 2µs making 1 call to DateTime::TimeZone::Local::Unix::Methods | ||
22 | 2 | 52.7ms | my $tz = $subclass->$meth(); # spent 52.7ms making 1 call to DateTime::TimeZone::Local::Unix::FromEtcLocaltime
# spent 14µs making 1 call to DateTime::TimeZone::Local::FromEnv | ||
23 | |||||
24 | return $tz if $tz; | ||||
25 | } | ||||
26 | |||||
27 | die "Cannot determine local time zone\n"; | ||||
28 | } | ||||
29 | |||||
30 | { | ||||
31 | # Stolen from File::Spec. My theory is that other folks can write | ||||
32 | # the non-existent modules if they feel a need, and release them | ||||
33 | # to CPAN separately. | ||||
34 | 2 | 5µs | my %subclass = ( | ||
35 | MSWin32 => 'Win32', | ||||
36 | VMS => 'VMS', | ||||
37 | MacOS => 'Mac', | ||||
38 | os2 => 'OS2', | ||||
39 | epoc => 'Epoc', | ||||
40 | NetWare => 'Win32', | ||||
41 | symbian => 'Win32', | ||||
42 | dos => 'OS2', | ||||
43 | cygwin => 'Unix', | ||||
44 | ); | ||||
45 | |||||
46 | # spent 4.81ms (20µs+4.79) within DateTime::TimeZone::Local::_load_subclass which was called:
# once (20µs+4.79ms) by DateTime::TimeZone::Local::TimeZone at line 19 | ||||
47 | 8 | 24µs | my $class = shift; | ||
48 | |||||
49 | my $os_name = $subclass{$^O} || $^O; | ||||
50 | my $subclass = $class . '::' . $os_name; | ||||
51 | |||||
52 | 1 | 5µs | return $subclass if is_class_loaded($subclass); # spent 5µs making 1 call to Class::Load::XS::is_class_loaded | ||
53 | |||||
54 | 1 | 185µs | return $subclass if try_load_class($subclass); # spent 185µs making 1 call to Class::Load::try_load_class | ||
55 | |||||
56 | $subclass = $class . '::Unix'; | ||||
57 | |||||
58 | 1 | 4.60ms | load_class($subclass); # spent 4.60ms making 1 call to Class::Load::load_class | ||
59 | |||||
60 | return $subclass; | ||||
61 | } | ||||
62 | } | ||||
63 | |||||
64 | # spent 14µs (11+3) within DateTime::TimeZone::Local::FromEnv which was called:
# once (11µs+3µs) by DateTime::TimeZone::Local::TimeZone at line 22 | ||||
65 | 4 | 10µs | my $class = shift; | ||
66 | |||||
67 | 1 | 800ns | foreach my $var ( $class->EnvVars() ) { # spent 800ns making 1 call to DateTime::TimeZone::Local::Unix::EnvVars | ||
68 | 1 | 2µs | if ( $class->_IsValidName( $ENV{$var} ) ) { # spent 2µs making 1 call to DateTime::TimeZone::Local::_IsValidName | ||
69 | my $tz; | ||||
70 | { | ||||
71 | local $@; | ||||
72 | local $SIG{__DIE__}; | ||||
73 | $tz = eval { DateTime::TimeZone->new( name => $ENV{$var} ) }; | ||||
74 | } | ||||
75 | return $tz if $tz; | ||||
76 | } | ||||
77 | } | ||||
78 | |||||
79 | return; | ||||
80 | } | ||||
81 | |||||
82 | # spent 2µs within DateTime::TimeZone::Local::_IsValidName which was called:
# once (2µs+0s) by DateTime::TimeZone::Local::FromEnv at line 68 | ||||
83 | 2 | 4µs | shift; | ||
84 | |||||
85 | return 0 unless defined $_[0]; | ||||
86 | return 0 if $_[0] eq 'local'; | ||||
87 | |||||
88 | return $_[0] =~ m{^[\w/\-\+]+$}; | ||||
89 | } | ||||
90 | |||||
91 | 1 | 4µs | 1; | ||
92 | |||||
93 | # ABSTRACT: Determine the local system's time zone | ||||
94 | |||||
95 | __END__ |