Last active
January 10, 2018 01:49
-
-
Save gbpereira/7adc618bd121c113567c to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env ruby | |
if ARGV.length >= 2 | |
h, m = 0, 0 | |
ARGV.each do |e| | |
h += e.split(':').first.to_i | |
m += e.split(':').last.to_i | |
end | |
h += (m / 60).to_i | |
m = m % 60 | |
puts 'Total: %02d:%02d.' % [h, m] | |
else | |
puts 'Você precisa passar pelo menos dois argumentos.' | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment