LuaScripts/getTime.lua

16 lines
333 B
Lua
Raw Normal View History

2021-01-08 13:32:55 +00:00
local internet = require("internet")
while true do
local handle = internet.request("http://worldclockapi.com/api/json/utc/now")
local result = ""
for chunk in handle do
result = result..chunk
end
local f = io.open("time.txt", "w")
2021-01-08 13:33:43 +00:00
f:write(result)
2021-01-08 13:38:15 +00:00
f:seek(31)
local time = f:read(16)
2021-01-08 13:32:55 +00:00
f:close()
2021-01-08 13:38:15 +00:00
print(time)
2021-01-08 13:32:55 +00:00
end