line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WRT::Date; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
1121
|
use strict; |
|
4
|
|
|
|
|
10
|
|
|
4
|
|
|
|
|
108
|
|
4
|
4
|
|
|
4
|
|
19
|
use warnings; |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
116
|
|
5
|
|
|
|
|
|
|
|
6
|
4
|
|
|
4
|
|
20
|
use base qw(Exporter); |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
398
|
|
7
|
|
|
|
|
|
|
our @EXPORT_OK = qw(iso_date get_mtime); |
8
|
|
|
|
|
|
|
|
9
|
4
|
|
|
4
|
|
319
|
use POSIX qw(strftime); |
|
4
|
|
|
|
|
5140
|
|
|
4
|
|
|
|
|
24
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# Return an ISO 8601 date string for the given epoch time. |
12
|
|
|
|
|
|
|
sub iso_date { |
13
|
3
|
|
|
3
|
0
|
5
|
my ($time) = @_; |
14
|
3
|
|
|
|
|
101
|
return strftime("%Y-%m-%dT%H:%M:%SZ", localtime($time)); |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub get_mtime |
18
|
|
|
|
|
|
|
{ |
19
|
4
|
|
|
4
|
0
|
92
|
my (@filenames) = @_; |
20
|
|
|
|
|
|
|
|
21
|
4
|
|
|
|
|
6
|
my @mtimes; |
22
|
4
|
|
|
|
|
8
|
for my $filename (@filenames) { |
23
|
|
|
|
|
|
|
#my( $dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, |
24
|
|
|
|
|
|
|
# $atime, $mtime, $ctime, $blksize, $blocks ) |
25
|
|
|
|
|
|
|
# = stat( $filename ); |
26
|
|
|
|
|
|
|
|
27
|
4
|
|
|
|
|
55
|
push @mtimes, (stat $filename)[9]; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# return a list if we've got more than one, a scalar |
31
|
|
|
|
|
|
|
# otherwise. is this evil? or even necessary? |
32
|
4
|
50
|
|
|
|
12
|
if (@mtimes > 1) { |
33
|
0
|
|
|
|
|
0
|
return @mtimes; |
34
|
|
|
|
|
|
|
} else { |
35
|
4
|
|
|
|
|
17
|
return $mtimes[0]; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
1; |