humanise_seconds now handles non-numeric input sanely.
This commit is contained in:
parent
104598bd86
commit
ba8a12ccae
@ -625,6 +625,9 @@ sub humanise_seconds {
|
||||
my ($frac, $mins, $hours, $days);
|
||||
my $result = "";
|
||||
|
||||
# Do nothing to non-digit strings.
|
||||
return $seconds unless($seconds =~ /^\d+(\.\d+)?$/);
|
||||
|
||||
($frac) = $seconds =~ /\.(\d+)$/;
|
||||
$days = int($seconds / (24 * 60 * 60));
|
||||
$hours = ($seconds / (60 * 60)) % 24;
|
||||
|
Loading…
x
Reference in New Issue
Block a user