1 |
commit: 34db670aff7f8da1eb1c90b7ad68cec526cfb4c6 |
2 |
Author: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Apr 28 16:45:32 2020 +0000 |
4 |
Commit: Robin H. Johnson <robbat2 <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Apr 28 16:45:52 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/gentoo-mirrorstats.git/commit/?id=34db670a |
7 |
|
8 |
probe-mirmon: fix rsync case |
9 |
|
10 |
Signed-off-by: Robin H. Johnson <robbat2 <AT> gentoo.org> |
11 |
|
12 |
probe-mirmon | 11 +++++++---- |
13 |
1 file changed, 7 insertions(+), 4 deletions(-) |
14 |
|
15 |
diff --git a/probe-mirmon b/probe-mirmon |
16 |
index 7b57923..ddd8546 100755 |
17 |
--- a/probe-mirmon |
18 |
+++ b/probe-mirmon |
19 |
@@ -17,6 +17,8 @@ |
20 |
|
21 |
main(@ARGV); |
22 |
|
23 |
+use strict; |
24 |
+use warnings; |
25 |
use Date::Parse (); # dev-perl/TimeDate |
26 |
use File::Tempdir; # dev-perl/File-Tempdir |
27 |
|
28 |
@@ -56,19 +58,20 @@ sub handle_rsync { |
29 |
exit 900; # rediculous exit code. |
30 |
}; |
31 |
|
32 |
- print munge_date(<fh>); |
33 |
+ print munge_date(<$fh>); |
34 |
exit 0; |
35 |
|
36 |
} |
37 |
|
38 |
sub munge_date { |
39 |
- my $timestr = $_; |
40 |
+ no warnings 'numeric'; ## no critic (TestingAndDebugging::ProhibitNoWarnings) |
41 |
+ my $timestr = shift; |
42 |
my $timestamp = int($timestr); |
43 |
my $year2020 = 1577836800; |
44 |
my $year2038 = 2145916800; |
45 |
# If the string starts with an epoch, just use that |
46 |
- if($int_timestamp >= $year2020 && $int_timestamp <= $year2038) { |
47 |
- return $int_timestamp; |
48 |
+ if($timestamp >= $year2020 && $timestamp <= $year2038) { |
49 |
+ return $timestamp; |
50 |
} else { |
51 |
return Date::Parse::str2time($timestr); |
52 |
} |