lib/model/time_code.rb
#Converts string-formatted time code to milliseconds
Converts string-formatted time code to milliseconds
Converts string - formatted time code to milliseconds
def convert_to_ms()
    split = @time_code_str.split(":")
    hours = split[0].to_i
    minutes = split[1].to_i
    seconds = split[2].to_i
    milliseconds = split[3].to_i
    milliseconds += seconds * 1000;
    milliseconds += (minutes * 60) * 1000
    milliseconds += (hours * 60 * 60) * 1000    
    return milliseconds
  end
def convert_to_ms ( ) split = @time_code_str . split ( ":" ) hours = split [ 0 ] . to_i minutes = split [ 1 ] . to_i seconds = split [ 2 ] . to_i milliseconds = split [ 3 ] . to_i milliseconds += seconds * 1000 ; milliseconds += ( minutes * 60 ) * 1000 milliseconds += ( hours * 60 * 60 ) * 1000 return milliseconds end
Converts string-formatted time code to milliseconds
Converts string - formatted time code to milliseconds
#puts "Hours: #{hours} Minutes: #{minutes} Seconds: #{seconds} Milliseconds: #{milliseconds}"