View difference between Paste ID: bCtAfYca and Dc0eaqAY
SHOW: | | - or go back to the newest paste.
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 not rs.getInput("back") then
15+
  if rs.getInput("bottom") then
16
        print("Circuit tripped at: "..getTime())
17
  rs.setOutput("back", false)
18
  sleep (60)
19
  end
20
end