Filename | /usr/local/share/perl/5.14.2/DateTime/TimeZone/Local.pm |
Statements | Executed 37 statements in 1.40ms |
Calls | P | F | Exclusive Time |
Inclusive Time |
Subroutine |
---|---|---|---|---|---|
1 | 1 | 1 | 3.56ms | 3.81ms | BEGIN@14 | DateTime::TimeZone::Local::
1 | 1 | 1 | 2.54ms | 13.6ms | BEGIN@12 | DateTime::TimeZone::Local::
1 | 1 | 1 | 47µs | 121ms | TimeZone | DateTime::TimeZone::Local::
1 | 1 | 1 | 46µs | 10.8ms | _load_subclass | DateTime::TimeZone::Local::
1 | 1 | 1 | 25µs | 32µs | FromEnv | DateTime::TimeZone::Local::
1 | 1 | 1 | 18µs | 18µs | BEGIN@5 | DateTime::TimeZone::Local::
1 | 1 | 1 | 17µs | 17µs | BEGIN@13 | DateTime::TimeZone::Local::
1 | 1 | 1 | 15µs | 22µs | BEGIN@9 | DateTime::TimeZone::Local::
1 | 1 | 1 | 15µs | 26µs | BEGIN@10 | DateTime::TimeZone::Local::
1 | 1 | 1 | 5µs | 5µs | _IsValidName | DateTime::TimeZone::Local::
Line | State ments |
Time on line |
Calls | Time in subs |
Code |
---|---|---|---|---|---|
1 | package DateTime::TimeZone::Local; | ||||
2 | { | ||||
3 | 2 | 2µs | $DateTime::TimeZone::Local::VERSION = '1.63'; | ||
4 | } | ||||
5 | # spent 18µs within DateTime::TimeZone::Local::BEGIN@5 which was called:
# once (18µs+0s) by DateTime::TimeZone::BEGIN@16 at line 7 | ||||
6 | 1 | 11µs | $DateTime::TimeZone::Local::AUTHORITY = 'cpan:DROLSKY'; | ||
7 | 1 | 41µs | 1 | 18µs | } # spent 18µs making 1 call to DateTime::TimeZone::Local::BEGIN@5 |
8 | |||||
9 | 2 | 46µs | 2 | 29µs | # spent 22µs (15+7) within DateTime::TimeZone::Local::BEGIN@9 which was called:
# once (15µs+7µs) by DateTime::TimeZone::BEGIN@16 at line 9 # spent 22µs making 1 call to DateTime::TimeZone::Local::BEGIN@9
# spent 7µs making 1 call to strict::import |
10 | 2 | 55µs | 2 | 37µs | # spent 26µs (15+11) within DateTime::TimeZone::Local::BEGIN@10 which was called:
# once (15µs+11µs) by DateTime::TimeZone::BEGIN@16 at line 10 # spent 26µs making 1 call to DateTime::TimeZone::Local::BEGIN@10
# spent 11µs making 1 call to warnings::import |
11 | |||||
12 | 2 | 212µs | 2 | 13.7ms | # spent 13.6ms (2.54+11.1) within DateTime::TimeZone::Local::BEGIN@12 which was called:
# once (2.54ms+11.1ms) by DateTime::TimeZone::BEGIN@16 at line 12 # spent 13.6ms making 1 call to DateTime::TimeZone::Local::BEGIN@12
# spent 99µs making 1 call to Exporter::import |
13 | 2 | 56µs | 1 | 17µs | # spent 17µs within DateTime::TimeZone::Local::BEGIN@13 which was called:
# once (17µs+0s) by DateTime::TimeZone::BEGIN@16 at line 13 # spent 17µs making 1 call to DateTime::TimeZone::Local::BEGIN@13 |
14 | 2 | 839µs | 1 | 3.81ms | # spent 3.81ms (3.56+250µs) within DateTime::TimeZone::Local::BEGIN@14 which was called:
# once (3.56ms+250µs) by DateTime::TimeZone::BEGIN@16 at line 14 # spent 3.81ms making 1 call to DateTime::TimeZone::Local::BEGIN@14 |
15 | |||||
16 | # spent 121ms (47µs+121) within DateTime::TimeZone::Local::TimeZone which was called:
# once (47µs+121ms) by DateTime::TimeZone::new at line 57 of DateTime/TimeZone.pm | ||||
17 | 1 | 1µs | my $class = shift; | ||
18 | |||||
19 | 1 | 3µs | 1 | 10.8ms | my $subclass = $class->_load_subclass(); # spent 10.8ms making 1 call to DateTime::TimeZone::Local::_load_subclass |
20 | |||||
21 | 1 | 11µs | 1 | 5µs | for my $meth ( $subclass->Methods() ) { # spent 5µs making 1 call to DateTime::TimeZone::Local::Unix::Methods |
22 | 2 | 13µs | 2 | 110ms | my $tz = $subclass->$meth(); # spent 110ms making 1 call to DateTime::TimeZone::Local::Unix::FromEtcLocaltime
# spent 32µs making 1 call to DateTime::TimeZone::Local::FromEnv |
23 | |||||
24 | 2 | 8µs | 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 | 11µ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 10.8ms (46µs+10.8) within DateTime::TimeZone::Local::_load_subclass which was called:
# once (46µs+10.8ms) by DateTime::TimeZone::Local::TimeZone at line 19 | ||||
47 | 1 | 600ns | my $class = shift; | ||
48 | |||||
49 | 1 | 4µs | my $os_name = $subclass{$^O} || $^O; | ||
50 | 1 | 2µs | my $subclass = $class . '::' . $os_name; | ||
51 | |||||
52 | 1 | 18µs | 1 | 7µs | return $subclass if is_class_loaded($subclass); # spent 7µs making 1 call to Class::Load::XS::is_class_loaded |
53 | |||||
54 | 1 | 15µs | 1 | 398µs | return $subclass if try_load_class($subclass); # spent 398µs making 1 call to Class::Load::try_load_class |
55 | |||||
56 | 1 | 900ns | $subclass = $class . '::Unix'; | ||
57 | |||||
58 | 1 | 3µs | 1 | 10.4ms | load_class($subclass); # spent 10.4ms making 1 call to Class::Load::load_class |
59 | |||||
60 | 1 | 7µs | return $subclass; | ||
61 | } | ||||
62 | } | ||||
63 | |||||
64 | # spent 32µs (25+7) within DateTime::TimeZone::Local::FromEnv which was called:
# once (25µs+7µs) by DateTime::TimeZone::Local::TimeZone at line 22 | ||||
65 | 1 | 1µs | my $class = shift; | ||
66 | |||||
67 | 1 | 3µs | 1 | 2µs | foreach my $var ( $class->EnvVars() ) { # spent 2µs making 1 call to DateTime::TimeZone::Local::Unix::EnvVars |
68 | 1 | 12µs | 1 | 5µs | if ( $class->_IsValidName( $ENV{$var} ) ) { # spent 5µ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 | 1 | 5µs | return; | ||
80 | } | ||||
81 | |||||
82 | # spent 5µs within DateTime::TimeZone::Local::_IsValidName which was called:
# once (5µs+0s) by DateTime::TimeZone::Local::FromEnv at line 68 | ||||
83 | 1 | 300ns | shift; | ||
84 | |||||
85 | 1 | 8µs | return 0 unless defined $_[0]; | ||
86 | return 0 if $_[0] eq 'local'; | ||||
87 | |||||
88 | return $_[0] =~ m{^[\w/\-\+]+$}; | ||||
89 | } | ||||
90 | |||||
91 | 1 | 12µs | 1; | ||
92 | |||||
93 | # ABSTRACT: Determine the local system's time zone | ||||
94 | |||||
95 | __END__ |