upvalue save alarm comparison

This commit is contained in:
Axel Kittenberger 2010-12-01 13:17:04 +00:00
parent ded00765c6
commit 288cf4ae61
3 changed files with 17 additions and 13 deletions

View File

@ -1,7 +1,7 @@
require("socket")
settings.nodaemon = true
--hostname = "irc.freenode.org"
hostname = "127.0.0.1"
hostname = "irc.freenode.org"
--hostname = "127.0.0.1"
port = 6667
nick = "lbot01"
chan = "##lfile01"

View File

@ -1610,6 +1610,12 @@ masterloop(lua_State *L)
return;
}
lua_pop(L, 2);
if (lua_gettop(L)) {
logstring("Error", "internal, stack is dirty.")
l_stackdump(L);
exit(-1); // ERRNO
}
}
}

View File

@ -2620,29 +2620,27 @@ function runner.getAlarm()
----
-- checks if current nearest alarm or a is earlier
--
local function checkAlarm(a)
local function checkAlarm(alarm, a)
if alarm == true or not a then
-- already immediate or no new alarm
return
return alarm
end
if not alarm then
alarm = a
-- returns the ealier time
if not alarm or a < alarm then
return a
else
-- the earlier time
if a < alarm then
alarm = a
end
return alarm
end
end
-- checks all syncs for their earliest alarm
for _, s in Syncs.iwalk() do
checkAlarm(s:getAlarm())
alarm = checkAlarm(alarm, s:getAlarm())
end
-- checks if a statusfile write has been delayed
checkAlarm(StatusFile.getAlarm())
alarm = checkAlarm(alarm, StatusFile.getAlarm())
-- checks for an userAlarm
checkAlarm(UserAlarms.getAlarm())
alarm = checkAlarm(alarm, UserAlarms.getAlarm())
log("Debug","getAlarm returns: ",alarm)
return alarm