line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package DateTime::TimeZone::Local::hpux; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
4130
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
70
|
|
4
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
183
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
# Debugging flags, used in the testsuite |
7
|
|
|
|
|
|
|
BEGIN { |
8
|
2
|
50
|
|
2
|
|
15
|
defined &SKIP_ETC_TIMEZONE or *SKIP_ETC_TIMEZONE = sub () { 0 }; |
9
|
2
|
50
|
|
|
|
87
|
defined &SKIP_JAVA or *SKIP_JAVA = sub () { 0 }; |
10
|
|
|
|
|
|
|
} |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
2
|
|
|
2
|
|
12
|
use base 'DateTime::TimeZone::Local'; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
1325
|
|
15
|
2
|
|
|
2
|
|
82934
|
use DateTime::TimeZone::HPUX; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
684
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub Methods |
18
|
|
|
|
|
|
|
{ |
19
|
1
|
|
|
1
|
1
|
39
|
qw( _FromEnv _FromEtcTIMEZONE _FromJava ) |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# TODO Build the full timezone database from /usr/lib/tztab |
23
|
|
|
|
|
|
|
sub _FromEnv |
24
|
|
|
|
|
|
|
{ |
25
|
1
|
50
|
|
1
|
|
11
|
return unless exists $ENV{TZ}; |
26
|
1
|
|
|
|
|
5
|
DateTime::TimeZone::HPUX::_hpux_to_olson($ENV{TZ}) |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub _FromEtcTIMEZONE |
30
|
|
|
|
|
|
|
{ |
31
|
1
|
|
|
1
|
|
11
|
return if SKIP_ETC_TIMEZONE; |
32
|
|
|
|
|
|
|
|
33
|
1
|
|
|
|
|
4
|
my $tz_file = '/etc/TIMEZONE'; |
34
|
|
|
|
|
|
|
|
35
|
1
|
50
|
33
|
|
|
26
|
return unless -f $tz_file && -r _; |
36
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
0
|
local *TZ; |
38
|
0
|
0
|
|
|
|
0
|
open TZ, "<$tz_file" |
39
|
|
|
|
|
|
|
or die "Cannot read $tz_file: $!"; |
40
|
|
|
|
|
|
|
|
41
|
0
|
|
|
|
|
0
|
my $name; |
42
|
0
|
|
|
|
|
0
|
while ( defined( $name = ) ) |
43
|
|
|
|
|
|
|
{ |
44
|
0
|
0
|
|
|
|
0
|
if ( $name =~ /\A\s*TZ\s*=\s*(\S+)/ ) |
45
|
|
|
|
|
|
|
{ |
46
|
0
|
|
|
|
|
0
|
$name = $1; |
47
|
0
|
|
|
|
|
0
|
last; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
} |
50
|
0
|
|
|
|
|
0
|
close TZ; |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
0
|
DateTime::TimeZone::HPUX::_hpux_to_olson($name) |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# Retrieve the default timezone using Java (java.util.TimeZone.getDefault()) |
56
|
|
|
|
|
|
|
sub _FromJava |
57
|
|
|
|
|
|
|
{ |
58
|
1
|
|
|
1
|
|
7
|
return if SKIP_JAVA; |
59
|
1
|
|
|
|
|
10
|
warn('Retrieving default timezone using Java (SLOOOOOW)... You should instead set $ENV{TZ}'); |
60
|
1
|
|
|
|
|
4
|
my $tz_name = DateTime::TimeZone::HPUX::_olson_from_java(); |
61
|
1
|
50
|
|
|
|
6
|
return unless defined $tz_name; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
# Build a DT::TZ object from the name returned by Java |
64
|
0
|
|
|
|
|
|
local $@; |
65
|
0
|
|
|
|
|
|
return eval { DateTime::TimeZone->new(name => $tz_name) }; |
|
0
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
1; |
70
|
|
|
|
|
|
|
__END__ |