Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Works best with 5x5 or 4x4 monitors--
- print("12-Hour-System? (Y/N)")
- hour = read()
- print("")
- print("Monitorheight: ")
- height = tonumber(read())
- print("")
- print("Monitorlength: ")
- length = tonumber(read())
- print("")
- print("Clock is running")
- local monitor = peripheral.wrap("back")
- monitor.setTextScale(5)
- while true do
- local decimalTime = os.time()
- local hours = math.floor(decimalTime)
- local minutes = math.floor((decimalTime - hours) * 100 * 0.6)
- local ampm = "PM"
- if hour == "Y" then
- if hours > 12 then
- hours = hours - 12
- ampm = "PM"
- else
- ampm = "AM"
- end
- else
- ampm = ""
- end
- monitor.clear()
- monitor.setCursorPos(length - 1.5,height - 1)
- if minutes < 10 then
- monitor.write(hours..":0"..minutes.." "..ampm)
- else
- monitor.write(hours..":"..minutes.." "..ampm)
- end
- sleep(2)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement