| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Time::XS; |
|
2
|
26
|
|
|
26
|
|
3118157
|
use 5.012; |
|
|
26
|
|
|
|
|
338
|
|
|
3
|
26
|
|
|
26
|
|
9853
|
use XS::Framework; |
|
|
26
|
|
|
|
|
200585
|
|
|
|
26
|
|
|
|
|
927
|
|
|
4
|
26
|
|
|
26
|
|
183
|
use XS::Install::Payload; |
|
|
26
|
|
|
|
|
49
|
|
|
|
26
|
|
|
|
|
554
|
|
|
5
|
26
|
|
|
26
|
|
11037
|
use Export::XS::Auto; |
|
|
26
|
|
|
|
|
39250
|
|
|
|
26
|
|
|
|
|
12719
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '3.1.9'; |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
XS::Loader::bootstrap(); |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
__init__(); |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub __init__ { |
|
14
|
26
|
50
|
|
26
|
|
528
|
use_embed_zones() unless tzsysdir(); # use embed zones by default where system zones are unavailable |
|
15
|
|
|
|
|
|
|
} |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub use_system_zones { |
|
18
|
0
|
0
|
|
0
|
0
|
0
|
if (tzsysdir()) { |
|
19
|
0
|
|
|
|
|
0
|
tzdir(undef); |
|
20
|
|
|
|
|
|
|
} else { |
|
21
|
0
|
|
|
|
|
0
|
warn("Time::XS[use_system_zones]: this OS has no olson timezone files, you cant use system zones"); |
|
22
|
|
|
|
|
|
|
} |
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub use_embed_zones { |
|
26
|
25
|
|
|
25
|
0
|
34463
|
my $dir = XS::Install::Payload::payload_dir('Time::XS'); |
|
27
|
25
|
|
|
|
|
3008
|
return tzdir("$dir/zoneinfo"); |
|
28
|
|
|
|
|
|
|
} |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub available_zones { |
|
31
|
3
|
50
|
|
3
|
0
|
112288
|
my $zones_dir = tzdir() or return; |
|
32
|
3
|
|
|
|
|
16
|
return _scan_zones($zones_dir, ''); |
|
33
|
|
|
|
|
|
|
} |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub _scan_zones { |
|
36
|
89
|
|
|
89
|
|
195
|
my ($root, $subdir) = @_; |
|
37
|
89
|
100
|
|
|
|
210
|
my $dir = $subdir ? "$root/$subdir" : $root; |
|
38
|
89
|
|
|
|
|
134
|
my @list; |
|
39
|
89
|
50
|
|
|
|
2516
|
opendir my $dh, $dir or die "Time::XS[available_zones]: cannot open $dir: $!"; |
|
40
|
89
|
|
|
|
|
2686
|
while (my $entry = readdir $dh) { |
|
41
|
2704
|
|
|
|
|
5962
|
my $first = substr($entry, 0, 1); |
|
42
|
2704
|
100
|
66
|
|
|
9251
|
next if $first eq '.' or $first eq '_'; |
|
43
|
2526
|
|
|
|
|
4637
|
my $path = "$dir/$entry"; |
|
44
|
2526
|
100
|
|
|
|
66823
|
if (-d $path) { |
|
|
|
50
|
|
|
|
|
|
|
45
|
86
|
100
|
|
|
|
429
|
push @list, _scan_zones($root, $subdir ? "$subdir/$entry" : $entry); |
|
46
|
|
|
|
|
|
|
} elsif (-f $path) { |
|
47
|
2440
|
50
|
|
|
|
74511
|
open my $fh, '<', $path or die "Time::XS[available_zones]: cannot open $path: $!"; |
|
48
|
2440
|
|
|
|
|
29976
|
my $content = readline $fh; |
|
49
|
2440
|
100
|
|
|
|
12210
|
next unless $content =~ /^TZif/; |
|
50
|
2432
|
100
|
|
|
|
6884
|
next if $entry =~ /(posixrules|Factory)/; |
|
51
|
2426
|
100
|
|
|
|
8697
|
push @list, $subdir ? "$subdir/$entry" : $entry; |
|
52
|
2426
|
|
|
|
|
36830
|
close $fh; |
|
53
|
|
|
|
|
|
|
} |
|
54
|
|
|
|
|
|
|
} |
|
55
|
89
|
|
|
|
|
1079
|
closedir $dh; |
|
56
|
|
|
|
|
|
|
|
|
57
|
89
|
|
|
|
|
1840
|
return @list; |
|
58
|
|
|
|
|
|
|
} |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |