line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Win32::UrlCache::FileTimePP;
|
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
23077
|
use strict;
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
127
|
|
4
|
2
|
|
|
2
|
|
13
|
use warnings;
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
59
|
|
5
|
2
|
|
|
2
|
|
10
|
use base qw( Exporter );
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
298
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our @EXPORT = qw( filetime );
|
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
7970
|
use Math::BigInt try => 'GMP';
|
|
2
|
|
|
|
|
76827
|
|
|
2
|
|
|
|
|
14
|
|
10
|
2
|
|
|
2
|
|
50773
|
use DateTime;
|
|
2
|
|
|
|
|
484416
|
|
|
2
|
|
|
|
|
118
|
|
11
|
2
|
|
|
2
|
|
120
|
use DateTime::Duration;
|
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
1410
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub filetime {
|
14
|
2
|
|
|
2
|
1
|
1588
|
my $filetime = shift;
|
15
|
|
|
|
|
|
|
|
16
|
2
|
|
|
|
|
5
|
my @bytes;
|
17
|
2
|
100
|
66
|
|
|
16
|
if ( length( $filetime ) == 18 && substr( $filetime, 0, 2 ) eq '0x' ) {
|
18
|
1
|
|
|
|
|
10
|
@bytes = map { chr(hex($_)) }
|
|
8
|
|
|
|
|
21
|
|
19
|
|
|
|
|
|
|
substr( $filetime, 2 ) =~ /(..)/g;
|
20
|
|
|
|
|
|
|
}
|
21
|
|
|
|
|
|
|
else {
|
22
|
1
|
|
|
|
|
8
|
@bytes = split //, $filetime;
|
23
|
|
|
|
|
|
|
}
|
24
|
|
|
|
|
|
|
|
25
|
2
|
|
|
|
|
20
|
my $hundred_nanoseconds = (
|
26
|
|
|
|
|
|
|
ord( $bytes[7] ) * ( 256 ** 7 ) +
|
27
|
|
|
|
|
|
|
ord( $bytes[6] ) * ( 256 ** 6 ) +
|
28
|
|
|
|
|
|
|
ord( $bytes[5] ) * ( 256 ** 5 ) +
|
29
|
|
|
|
|
|
|
ord( $bytes[4] ) * ( 256 ** 4 ) +
|
30
|
|
|
|
|
|
|
ord( $bytes[3] ) * ( 256 ** 3 ) +
|
31
|
|
|
|
|
|
|
ord( $bytes[2] ) * ( 256 ** 2 ) +
|
32
|
|
|
|
|
|
|
ord( $bytes[1] ) * ( 256 ** 1 ) +
|
33
|
|
|
|
|
|
|
ord( $bytes[0] ) * ( 256 ** 0 )
|
34
|
|
|
|
|
|
|
);
|
35
|
|
|
|
|
|
|
|
36
|
2
|
|
|
|
|
6
|
my $seconds = $hundred_nanoseconds / 10000000;
|
37
|
2
|
|
|
|
|
4
|
my $minutes = $seconds / 60;
|
38
|
2
|
|
|
|
|
4
|
my $hours = $minutes / 60;
|
39
|
2
|
|
|
|
|
3
|
my $days = $hours / 24;
|
40
|
|
|
|
|
|
|
|
41
|
2
|
|
|
|
|
18
|
my $start = DateTime->new(
|
42
|
|
|
|
|
|
|
year => 1601,
|
43
|
|
|
|
|
|
|
month => 1,
|
44
|
|
|
|
|
|
|
day => 1,
|
45
|
|
|
|
|
|
|
hour => 0,
|
46
|
|
|
|
|
|
|
minute => 0,
|
47
|
|
|
|
|
|
|
second => 0,
|
48
|
|
|
|
|
|
|
time_zone => 'GMT',
|
49
|
|
|
|
|
|
|
);
|
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
# explicitly stringify to unbless
|
52
|
2
|
|
|
|
|
752
|
my $duration = DateTime::Duration->new(
|
53
|
|
|
|
|
|
|
days => "$days",
|
54
|
|
|
|
|
|
|
hours => "".($hours % 24),
|
55
|
|
|
|
|
|
|
minutes => "".($minutes % 60),
|
56
|
|
|
|
|
|
|
seconds => "".($seconds % 60),
|
57
|
|
|
|
|
|
|
);
|
58
|
|
|
|
|
|
|
|
59
|
2
|
|
|
|
|
223
|
my $date = $start + $duration;
|
60
|
|
|
|
|
|
|
}
|
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
1;
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
__END__
|