aboutsummaryrefslogtreecommitdiff
path: root/avgtime.pl
blob: 8d7f656dbba604196ee92ac08f288ab7fbb42a39 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#!/usr/bin/perl -w

my $total;
my $count;

while(<>) {
	my ($mm, $ss, $cc) = /^(\d+):(\d+)\.(\d+)/;
	my $sec = $mm * 60 + $ss + $cc / 100;
	$total += $sec;
	$count++;
}

$avg = $total / $count;
$mm = int($avg / 60);
$ss = $avg - ($mm * 60);
$cs = $ss - int($ss);
$cs *= 100;
$ss = int($ss);
printf "avg time: %02d:%02d.%02d\n", $mm, $ss, $cs;