Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function switchdate(word)
- if word == "" then
- return "nil"
- else
- _newword = ""
- _year = string.sub(word,1,4)
- _month = string.sub(word,6,7)
- _day = string.sub(word,9,10)
- _newword = _day..".".._month..".".._year
- return _newword
- end
- end
- function correcttime(_time)
- if _time == "" then
- return "nil"
- else
- _newtime = ""
- _hour = string.sub(_time,1,2)
- _hour = tonumber(_hour)
- _hour = _hour + 1
- _hour = tostring(_hour)
- _minute = string.sub(_time,4,5)
- _second = string.sub(_time,7,8)
- _newtime = _hour..":".._minute..":".._second
- return _newtime
- end
- end
- term.clear()
- zeitlink = "http://www.timeapi.org/utc/now"
- time = http.get(zeitlink)
- if not http.get("http://example.com/") then
- term.clear()
- term.setCursorPos(1,1)
- term.write("Konnte keine Verbindung herstellen!")
- else
- readedtime = time.readAll()
- term.setCursorPos(1,1)
- term.write("Heute ist der "..switchdate(string.sub(readedtime,1,10)))
- term.setCursorPos(1,2)
- term.write("Es ist: "..correcttime(string.sub(readedtime,12,19)))
- end
Advertisement
Add Comment
Please, Sign In to add comment