Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local component = require("component")
- local fs = require("filesystem")
- local timenew = {}
- TIMEZONE = 0
- CORRECT = 0
- tz = TIMEZONE + CORRECT
- local t_correction = tz * 3600
- local function getTime()
- local file = io.open('/tmp/clock.dt', 'w')
- file:write('')
- file:close()
- local lastmod = tonumber(string.sub(fs.lastModified('/tmp/clock.dt'), 1, -4)) + t_correction
- local modp = tonumber(string.sub(fs.lastModified('/tmp/clock.dt'), 1, -4)) -(3*3600)
- -- local dt = os.date('%Y.%m.%d %H:%M:%S', lastmod)
- local dt = os.date('%H:%M:%S', lastmod)
- local dtp = os.date('%H:%M:%S', modp)
- return dt,dtp
- end
- function timenew.TimeScreen(str)
- while true do
- local dt, dtp = getTime()
- local formattimeN= "Нск - "..dt.." "
- local formattimeP= "Спб - "..dtp
- local screentime=component.screen_controller
- screentime.clearText(str)
- screentime.addText(str, formattimeN, 0x00ff00)
- screentime.addText(str, formattimeP, 0x0000ff)
- print (dt,dtp)
- os.sleep(1)
- end
- end
- return timenew
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement