Created
January 25, 2013 00:46
-
-
Save odyniec/4630468 to your computer and use it in GitHub Desktop.
A Perl oneliner (with a shell alias) that calculates the average running pace based on distance and time.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A Perl oneliner (with a shell alias) that calculates the average running pace based on distance and time | |
# Examples: | |
# pace 5 28:05 # 5 kilometres, 28 minutes and 5 seconds | |
# pace 10.5 45:28 # 10.5 kilometres, 45 minutes and 28 seconds | |
# pace 42.195 2:03:38 # Marathon, 2 hours, 3 minutes and 38 seconds (current WR) | |
alias pace="perl -e 'map{\$t+=\$_*60**\$i++}reverse split/:/,pop;\$t/=pop;printf\"%d:%02d\n\",\$t/60,\$t%60'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment