2021-01-07 23:30:28 +00:00
|
|
|
local event = require("event")
|
|
|
|
local keyboard = require("keyboard")
|
|
|
|
local component = require("component")
|
2021-01-08 00:04:54 +00:00
|
|
|
local fs = require("filesystem")
|
2021-01-07 23:30:28 +00:00
|
|
|
local tunnel = component.tunnel
|
2021-01-08 00:04:54 +00:00
|
|
|
local TIME_ZONE = 2
|
|
|
|
local t_correction = TIME_ZONE * 3600
|
2021-01-08 00:08:54 +00:00
|
|
|
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
|
2021-01-08 00:04:54 +00:00
|
|
|
end
|
2021-01-07 23:30:28 +00:00
|
|
|
while true do
|
|
|
|
local _, _, _, _, _, message = event.pull("modem_message")
|
2021-01-08 00:35:28 +00:00
|
|
|
local log = "["..os.dateRL("%x %X").."]".." "..message
|
|
|
|
print(log)
|
2021-01-08 00:36:26 +00:00
|
|
|
local f = io.open("logs.txt", "w")
|
2021-01-08 00:38:50 +00:00
|
|
|
f:write(log)
|
2021-01-08 00:35:28 +00:00
|
|
|
f:close()
|
2021-01-07 23:30:28 +00:00
|
|
|
tunnel.send("succes!")
|
|
|
|
end
|