Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.83 KB | None | 0 0
  1. local switch = "am"
  2. local hour = 10
  3. local min = 0
  4. local sec = 0
  5. --mon = peripheralWrap("back")
  6.  
  7. while true do
  8. term.clear()
  9. term.setCursorPos(1,1)
  10. print("Eatern Standard Time")
  11. sec = sec+1
  12. if sec>59 then
  13.   sec = 0
  14.   min = min+1
  15. end
  16.  
  17. if min > 59 then
  18.   min = 0
  19.   hour = hour+1
  20. end
  21.  
  22. if hour > 12 then
  23.   if switch=="am" then
  24.     switch = "pm"
  25.   else
  26.     switch = "am"
  27.   end
  28.     hour = 1
  29. end
  30.  
  31. if min <10 and sec <10 then
  32.   print(tostring(hour)..":0"..tostring(min)..":0"..tostring(sec).." "..switch)
  33. elseif min<10 and sec>=10 then
  34.   print(tostring(hour)..":0"..tostring(min)..":"..tostring(sec).." "..switch)  
  35. elseif sec < 10 then
  36.   print(tostring(hour)..":"..tostring(min)..":0"..tostring(sec).." "..switch)  
  37. else
  38.   print(tostring(hour)..":"..tostring(min)..":"..tostring(sec).." "..switch)
  39. end
  40. sleep(1)
  41. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement