Advertisement
darearkin

Untitled

Apr 2nd, 2013
118
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. if not http then
  5. print('HTTP is required')
  6. return "Needs http to be enabled in the config"
  7. end
  8. local request = http.get(time_url)
  9. local time_content = request.readAll()
  10. request.close()
  11. local search_text = [[<div id="analog%-digital">.-<span class="font7">(.-)</span>]]
  12. local _,_, global_time = time_content:find(search_text)
  13. local global_time = global_time:gsub("%s", "")
  14. return global_time
  15. end
  16.  
  17. while true do
  18. rs.setOutput("back", true)
  19. os.pullEvent("redstone") --Waits until redstone changes states
  20. if rs.getInput("bottom") then
  21. print("Circuit tripped at: "..getTime())
  22. rs.setOutput("back", false)
  23. sleep (60)
  24. end
  25. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement