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 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
  17.  
  18.  
Success #stdin #stdout 0s 2832KB
stdin
Standard input is empty
stdout
20:03:02
20:03:03
20:03:04
20:03:05
20:03:06
20:03:07
20:03:08
20:03:09
20:03:10
20:03:11
20:03:12
20:03:13
20:03:14
20:03:15
20:03:16
20:03:17
20:03:18
20:03:19
20:03:20
20:03:21
20:03:22
20:03:23
20:03:24
20:03:25
20:03:26
20:03:27
20:03:28
20:03:29
20:03:30
20:03:31
20:03:32
20:03:33
20:03:34
20:03:35