line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Time::XS; |
2
|
26
|
|
|
26
|
|
2692920
|
use 5.012; |
|
26
|
|
|
|
|
312
|
|
3
|
26
|
|
|
26
|
|
8511
|
use XS::Framework; |
|
26
|
|
|
|
|
89414
|
|
|
26
|
|
|
|
|
724
|
|
4
|
26
|
|
|
26
|
|
151
|
use XS::Install::Payload; |
|
26
|
|
|
|
|
39
|
|
|
26
|
|
|
|
|
541
|
|
5
|
26
|
|
|
26
|
|
9065
|
use Export::XS::Auto; |
|
26
|
|
|
|
|
32881
|
|
|
26
|
|
|
|
|
10960
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '3.1.8'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
XS::Loader::bootstrap(); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
__init__(); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub __init__ { |
14
|
26
|
50
|
|
26
|
|
477
|
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
|
1
|
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
|
1
|
30345
|
my $dir = XS::Install::Payload::payload_dir('Time::XS'); |
27
|
25
|
|
|
|
|
2604
|
return tzdir("$dir/zoneinfo"); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub available_zones { |
31
|
3
|
50
|
|
3
|
1
|
90484
|
my $zones_dir = tzdir() or return; |
32
|
3
|
|
|
|
|
12
|
return _scan_zones($zones_dir, ''); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub _scan_zones { |
36
|
89
|
|
|
89
|
|
177
|
my ($root, $subdir) = @_; |
37
|
89
|
100
|
|
|
|
197
|
my $dir = $subdir ? "$root/$subdir" : $root; |
38
|
89
|
|
|
|
|
98
|
my @list; |
39
|
89
|
50
|
|
|
|
2105
|
opendir my $dh, $dir or die "Time::XS[available_zones]: cannot open $dir: $!"; |
40
|
89
|
|
|
|
|
2328
|
while (my $entry = readdir $dh) { |
41
|
2704
|
|
|
|
|
4913
|
my $first = substr($entry, 0, 1); |
42
|
2704
|
100
|
66
|
|
|
7776
|
next if $first eq '.' or $first eq '_'; |
43
|
2526
|
|
|
|
|
3719
|
my $path = "$dir/$entry"; |
44
|
2526
|
100
|
|
|
|
54435
|
if (-d $path) { |
|
|
50
|
|
|
|
|
|
45
|
86
|
100
|
|
|
|
421
|
push @list, _scan_zones($root, $subdir ? "$subdir/$entry" : $entry); |
46
|
|
|
|
|
|
|
} elsif (-f $path) { |
47
|
2440
|
50
|
|
|
|
60195
|
open my $fh, '<', $path or die "Time::XS[available_zones]: cannot open $path: $!"; |
48
|
2440
|
|
|
|
|
22193
|
my $content = readline $fh; |
49
|
2440
|
100
|
|
|
|
9867
|
next unless $content =~ /^TZif/; |
50
|
2432
|
100
|
|
|
|
5488
|
next if $entry =~ /(posixrules|Factory)/; |
51
|
2426
|
100
|
|
|
|
6918
|
push @list, $subdir ? "$subdir/$entry" : $entry; |
52
|
2426
|
|
|
|
|
29647
|
close $fh; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
} |
55
|
89
|
|
|
|
|
945
|
closedir $dh; |
56
|
|
|
|
|
|
|
|
57
|
89
|
|
|
|
|
1612
|
return @list; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |