in reply to conversion of time intervals
sub hms { my ($s) = shift; my ($h, $m); $m = int($s / 60); $s = $s % 60; $h = int($m / 60); $m = $m % 60; if ($s > 0) { $m++; } if ($m == 60) { $m=0; $h++; } sprintf("%s:%02d:%02d",comma($h),$m, %s); } # Convert a number to a standard english comma'd string. # From "Programming Perl". sub comma { local ($_) = @_; 1 while s/(.*\d)(\d\d\d)/$1,$2/; $_; }
|
|---|