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") require("socket")
settings.nodaemon = true settings.nodaemon = true
--hostname = "irc.freenode.org" hostname = "irc.freenode.org"
hostname = "127.0.0.1" --hostname = "127.0.0.1"
port = 6667 port = 6667
nick = "lbot01" nick = "lbot01"
chan = "##lfile01" chan = "##lfile01"

View File

@ -1610,6 +1610,12 @@ masterloop(lua_State *L)
return; return;
} }
lua_pop(L, 2); 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 -- 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 if alarm == true or not a then
-- already immediate or no new alarm -- already immediate or no new alarm
return return alarm
end end
if not alarm then -- returns the ealier time
alarm = a if not alarm or a < alarm then
return a
else else
-- the earlier time return alarm
if a < alarm then
alarm = a
end
end end
end end
-- checks all syncs for their earliest alarm -- checks all syncs for their earliest alarm
for _, s in Syncs.iwalk() do for _, s in Syncs.iwalk() do
checkAlarm(s:getAlarm()) alarm = checkAlarm(alarm, s:getAlarm())
end end
-- checks if a statusfile write has been delayed -- checks if a statusfile write has been delayed
checkAlarm(StatusFile.getAlarm()) alarm = checkAlarm(alarm, StatusFile.getAlarm())
-- checks for an userAlarm -- checks for an userAlarm
checkAlarm(UserAlarms.getAlarm()) alarm = checkAlarm(alarm, UserAlarms.getAlarm())
log("Debug","getAlarm returns: ",alarm) log("Debug","getAlarm returns: ",alarm)
return alarm return alarm