LuaScripts/linkedGet.lua
2021-01-08 03:38:50 +03:00

27 lines
755 B
Lua

local event = require("event")
local keyboard = require("keyboard")
local component = require("component")
local fs = require("filesystem")
local tunnel = component.tunnel
local TIME_ZONE = 2
local t_correction = TIME_ZONE * 3600
function os.dateRL(format)
if not fs.get("/").isReadOnly() then
local time = io.open("/tmp/.time", "w")
time:write()
time:close()
os.sleep(0.01)
return os.date(format, fs.lastModified("/tmp/.time") / 1002.7)
else
return os.date(format)
end
end
while true do
local _, _, _, _, _, message = event.pull("modem_message")
local log = "["..os.dateRL("%x %X").."]".." "..message
print(log)
local f = io.open("logs.txt", "w")
f:write(log)
f:close()
tunnel.send("succes!")
end