Advertisement
leonardi

TimeAPI

Oct 13th, 2013
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. example = http.get("http://www.timeapi.org/gmt/in+2+hours")
  2. everything = tostring(example.readAll())
  3. example.close()
  4. date = string.sub(everything, 1,10)
  5. time = string.sub(everything, 12,19)
  6.  
  7. --print("It is now ", time, " ", date, " in Holland")
  8. mon = peripheral.wrap("top")
  9. term.redirect(mon)
  10. mon.setTextScale(2)
  11. mon.setCursorPos(15,1)
  12. print("Holland")
  13. mon.setCursorPos(2,2)
  14. print(time, " ", date)
  15.  
  16. example = http.get("http://www.timeapi.org/gmt/5+hours+ago")
  17. everything = tostring(example.readAll())
  18. example.close()
  19. date = string.sub(everything, 1,10)
  20. time = string.sub(everything, 12,19)
  21.  
  22. --print("It is now ", time, " ", date, " in 'Murica")
  23. mon.setCursorPos(15,4)
  24. print("America")
  25. mon.setCursorPos(2,5)
  26. print(time, " ", date)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement