Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local time_url = "http://www.worldtimeserver.com/current_time_in_US-CA.aspx" --Replace this
- rs.setOutput("back",true)
- while true do
- sleep (5)
- c = rs.getInput("bottom")
- if c == true then
- rs.setOutput("back", false)
- local x = getTime()
- print ("Circuit Tripped at "..(x))
- sleep (3600)
- rs.setOutput("back", true)
- end
- end
- local function getTime()
- local request = http.get(time_url)
- local time_content = request.readAll()
- request.close()
- local search_text = [[<div id="analog%-digital">.-<span class="font7">(.-)</span>]]
- local _,_, global_time = time_content:find(search_text)
- local global_time = global_time:gsub("%s", "")
- print(global_time)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement