Advertisement
darearkin

Untitled

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