aboutsummaryrefslogtreecommitdiff
path: root/avgtime.pl
diff options
context:
space:
mode:
Diffstat (limited to 'avgtime.pl')
-rw-r--r--avgtime.pl19
1 files changed, 19 insertions, 0 deletions
diff --git a/avgtime.pl b/avgtime.pl
new file mode 100644
index 0000000..8d7f656
--- /dev/null
+++ b/avgtime.pl
@@ -0,0 +1,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;