Jodo32

FTB Ticker - Time

Jul 19th, 2013
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. local mon = peripheral.wrap("right")
  2. function round(num, idp)
  3. local mult = 10^ (idp or 0)
  4. return math.floor(num * mult +0.5) / mult
  5. end
  6. function loop()
  7. while true do
  8. mon.clear()
  9. mon.setCursorPos(2,4)
  10. mon.setTextScale(4)
  11. z = os.time()
  12. if z < 12 then
  13. y = z
  14. a = y%1
  15. h = y - a
  16. b = a * 60
  17. m = round(b)
  18. if m >= 10 then
  19. min = m
  20. elseif m < 10 then
  21. min = "0"..m
  22. end
  23. if h < 1 then
  24. hour = 12
  25. elseif h >= 1 then
  26. hour = h
  27. end
  28. x = hour..":"..min.." AM"
  29. elseif z > 12 then
  30. y = z - 12
  31. a = y%1
  32. h = y - a
  33. b = a * 60
  34. m = round(b)
  35. if m >= 10 then
  36. min = m
  37. elseif m < 10 then
  38. min = "0"..m
  39. end
  40. if h < 1 then
  41. hour = 12
  42. elseif h >= 1 then
  43. hour = h
  44. end
  45. x = hour..":"..min.." PM"
  46. end
  47. mon.setTextColor(colors.lime)
  48. mon.write("The Current Time is ")
  49. mon.setTextColor(colors.blue)
  50. mon.write(x)
  51. sleep(1)
  52. end
  53. end
  54. loop()
Advertisement
Add Comment
Please, Sign In to add comment