fork(1) download
  1. function str2time(hora)
  2. return tonumber(string.sub(hora, 1, 2)) * 3600 + tonumber(string.sub(hora, 4, 5)) * 60 + tonumber(string.sub(hora, 7, 8))
  3. end
  4.  
  5. hora_array = {"20:03:02", "20:03:35"}
  6. horaInicial = str2time(hora_array[1])
  7. horaFinal = str2time(hora_array[2])
  8. hora_array = {}
  9. for i = horaInicial, horaFinal - 1, 5 do
  10. hora = math.floor(i / 3600)
  11. minuto = math.floor((i - hora * 3600) / 60)
  12. segundo = math.floor(i - hora * 3600 - minuto * 60)
  13. table.insert(hora_array, string.format("%02d:%02d:%02d", hora, minuto, segundo))
  14. end
  15.  
  16. for i, v in ipairs(hora_array) do print(v) end
Success #stdin #stdout 0s 2788KB
stdin
Standard input is empty
stdout
20:03:02
20:03:07
20:03:12
20:03:17
20:03:22
20:03:27
20:03:32