Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if not http then error("no http") end
- local httpResponseHandle = http.get("http://artemix.hu/cctime.php?timezone=FOR_GODS_SAKE_SET_THIS_TO_SOMETHING")
- if not httpResponseHandle then error("error fetching time") end
- local timeTable = textutils.unserialize(httpResponseHandle.readAll())
- httpResponseHandle.close()
- local hour = timeTable.h
- local minute = timeTable.m
- local second = timeTable.s
- local interval = 1
- while true do
- sleep(interval)
- second = second + interval
- if not (second < 60) then
- second = second - 60
- minute = minute + 1
- end
- if not (minute < 60) then
- minute = minute - 60
- hour = hour + 1
- end
- if not (hour < 24) then
- hour = hour - 24
- end
- print(string.format("%02d:%02d:%02d", hour, minute, second))
- end
Add Comment
Please, Sign In to add comment