Update getTime.lua

This commit is contained in:
erius0 2021-01-08 17:06:36 +03:00 committed by GitHub
parent 61dd93b280
commit ed999ffe4c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,4 +1,8 @@
local internet = require("internet") local internet = require("internet")
local component = require("component")
local modem = component.modem
modem.open(69)
while true do while true do
local handle = internet.request("http://worldclockapi.com/api/json/utc/now") local handle = internet.request("http://worldclockapi.com/api/json/utc/now")
@ -17,5 +21,7 @@ while true do
f:seek("set", 44) f:seek("set", 44)
local min = f:read(2) local min = f:read(2)
f:close() f:close()
print(date.." "..hour..":"..min) local datetime = date.." "..hour..":"..min
print(datetime)
modem.broadcast(69, datetime)
end end