the fastest code is that which does not exist

GSoC/Meterpreter_Web_Console
Brent Cook 2018-05-07 10:13:38 -05:00
parent fcc38b75bf
commit d3e6e93d6a
1 changed files with 0 additions and 25 deletions

View File

@ -30,30 +30,5 @@ module Rex
str.empty? ? "0 secs" : str.strip
end
#
# Converts a string in the form n years g days x hours y mins z secs.
#
def self.str_to_sec(str)
fields = str.split
secs = 0
fields.each_with_index do |f, idx|
case f
when 'year', 'years'
secs += 31536000 * fields[idx - 1].to_i
when 'day', 'days'
secs += 86400 * fields[idx - 1].to_i
when 'hour', 'hours'
secs += 3600 * fields[idx - 1].to_i
when 'min', 'mins'
secs += 60 * fields[idx - 1].to_i
when 'sec', 'secs'
secs += 1 * fields[idx - 1].to_i
end
end
secs
end
end
end