Posted 01 April 2017 - 05:28 PM
I'm trying to create a 1.5 hour delay in my program using os.startTimer(5400). My understanding is that this runs a timer for 5400 seconds (90 minutes). Instead, the timer event triggers after less than a minute.
Through debug outputs, I've determined that it is the timer event causes it, and the timer id is the one expected. I've also added os.time as an output and the time difference is about 0.6. oddly this was the same whether the delay was 5400 or 3600.
rednet.open("top")
completed = 1
while true do
if completed ~= 0 then
redstone.setOutput("bottom", false)
timer = os.startTimer(3600)
print("Started ", timer, " ", os.time())
completed = 0
end
local event = os.pullEvent()
print(event)
print(timer)
print(os.time())
if (event == "redstone" and redstone.getInput("right") == true) or event == "timer" then
redstone.setOutput("bottom", true)
os.sleep(60)
redstone.setOutput("bottom", false)
os.sleep(30)
rednet.broadcast("farm", "farm")
print("Planting")
os.cancelTimer(timer)
completed = 1
end
end
Through debug outputs, I've determined that it is the timer event causes it, and the timer id is the one expected. I've also added os.time as an output and the time difference is about 0.6. oddly this was the same whether the delay was 5400 or 3600.