def str2sec(str)
if /(\d+):(\d+):(\d+)/ =~ str
return $1.to_i*3600+$2.to_i*60+$3.to_i
else
raise "unknown format: #{str.inspect}"
end
end