Advertisement
darearkin

Untitled

Apr 2nd, 2013
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.71 KB | None | 0 0
  1. local time_url = "http://www.worldtimeserver.com/current_time_in_US-CA.aspx" --Replace this
  2. rs.setOutput("back",true)
  3. while true do
  4. sleep (5)
  5. c = rs.getInput("bottom")
  6. if c == true then
  7. rs.setOutput("back", false)
  8. local x = getTime()
  9. print ("Circuit Tripped at "..(x))
  10. sleep (3600)
  11. rs.setOutput("back", true)
  12. end
  13. end
  14.  
  15. local function getTime()
  16. local request = http.get(time_url)
  17. local time_content = request.readAll()
  18. request.close()
  19. local search_text = [[<div id="analog%-digital">.-<span class="font7">(.-)</span>]]
  20. local _,_, global_time = time_content:find(search_text)
  21. local global_time = global_time:gsub("%s", "")
  22. print(global_time)
  23. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement