line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Time::XS; |
2
|
26
|
|
|
26
|
|
2804043
|
use 5.012; |
|
26
|
|
|
|
|
333
|
|
3
|
26
|
|
|
26
|
|
9158
|
use XS::Framework; |
|
26
|
|
|
|
|
94649
|
|
|
26
|
|
|
|
|
724
|
|
4
|
26
|
|
|
26
|
|
157
|
use XS::Install::Payload; |
|
26
|
|
|
|
|
63
|
|
|
26
|
|
|
|
|
510
|
|
5
|
26
|
|
|
26
|
|
10302
|
use Export::XS::Auto; |
|
26
|
|
|
|
|
35849
|
|
|
26
|
|
|
|
|
12135
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '3.1.7'; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
XS::Loader::bootstrap(); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
__init__(); |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub __init__ { |
14
|
26
|
50
|
|
26
|
|
479
|
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
|
32484
|
my $dir = XS::Install::Payload::payload_dir('Time::XS'); |
27
|
25
|
|
|
|
|
2728
|
return tzdir("$dir/zoneinfo"); |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub available_zones { |
31
|
3
|
50
|
|
3
|
1
|
98688
|
my $zones_dir = tzdir() or return; |
32
|
3
|
|
|
|
|
14
|
return _scan_zones($zones_dir, ''); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub _scan_zones { |
36
|
89
|
|
|
89
|
|
184
|
my ($root, $subdir) = @_; |
37
|
89
|
100
|
|
|
|
175
|
my $dir = $subdir ? "$root/$subdir" : $root; |
38
|
89
|
|
|
|
|
98
|
my @list; |
39
|
89
|
50
|
|
|
|
2196
|
opendir my $dh, $dir or die "Time::XS[available_zones]: cannot open $dir: $!"; |
40
|
89
|
|
|
|
|
2403
|
while (my $entry = readdir $dh) { |
41
|
2704
|
|
|
|
|
5497
|
my $first = substr($entry, 0, 1); |
42
|
2704
|
100
|
66
|
|
|
8634
|
next if $first eq '.' or $first eq '_'; |
43
|
2526
|
|
|
|
|
4118
|
my $path = "$dir/$entry"; |
44
|
2526
|
100
|
|
|
|
59838
|
if (-d $path) { |
|
|
50
|
|
|
|
|
|
45
|
86
|
100
|
|
|
|
380
|
push @list, _scan_zones($root, $subdir ? "$subdir/$entry" : $entry); |
46
|
|
|
|
|
|
|
} elsif (-f $path) { |
47
|
2440
|
50
|
|
|
|
66731
|
open my $fh, '<', $path or die "Time::XS[available_zones]: cannot open $path: $!"; |
48
|
2440
|
|
|
|
|
26181
|
my $content = readline $fh; |
49
|
2440
|
100
|
|
|
|
10854
|
next unless $content =~ /^TZif/; |
50
|
2432
|
100
|
|
|
|
6229
|
next if $entry =~ /(posixrules|Factory)/; |
51
|
2426
|
100
|
|
|
|
8144
|
push @list, $subdir ? "$subdir/$entry" : $entry; |
52
|
2426
|
|
|
|
|
33302
|
close $fh; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
} |
55
|
89
|
|
|
|
|
933
|
closedir $dh; |
56
|
|
|
|
|
|
|
|
57
|
89
|
|
|
|
|
1754
|
return @list; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |