diff --git a/linkedGet.lua b/linkedGet.lua index a08e3d3..5440dcb 100644 --- a/linkedGet.lua +++ b/linkedGet.lua @@ -1,23 +1,14 @@ local event = require("event") local keyboard = require("keyboard") local component = require("component") -local fs = require("filesystem") -local internet = require("internet") local tunnel = component.tunnel local success = "console: команда выполнена успешно" local fail = "console: неизвестная команда - пиши help" -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 +function getTime() + local _, _, _, _, _, time = event.pull("modem_message") + return time end function handleMessage(msg) @@ -43,7 +34,9 @@ end while true do local _, _, from, _, _, message = event.pull("modem_message") local answer = handleMessage(tostring(message)) - local log = "["..os.dateRL("%x %X").."] "..getUser(tostring(from))..": "..message.."\n".."["..os.dateRL("%x %X").."] "..answer + local time = getTime() + local user = getUser(tostring(from)) + local log = "["..time.."] "..user..": "..message.."\n".."["..time.."] "..answer print(log) local f = io.open("logs.txt", "a") f:write(log.."\n")