m = peripheral.wrap("top")
m.setTextScale(2)

while true do
m.clear()

local time = os.time()
local formattedTime = textutils.formatTime(time, false)


m.setTextColor(colors.white)
m.setCursorPos(2,2)
m.write("TIME:")
m.setCursorPos(2,3)
m.write(formattedTime)

if time > 6 or time < 19 then
m.setCursorPos(2,5)
m.setTextColor(colors.lime)
m.write("DAY")
end

if time < 5 or time > 18 then
m.setCursorPos(2,5)
m.setTextColor(colors.red)
m.write("NIGHT")
end
sleep(1)
end

