Skip to content

Commit 63288fc

Browse files
committed
Less server time function calls.
1 parent 1967ae2 commit 63288fc

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

core.lua

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -580,21 +580,22 @@ function SB:is_off_alert_lockout()
580580
local udi = self:get_UDI()
581581
local q = self.query
582582
local index = q.guid
583+
local timeNow=GetServerTime()
583584
if not q.guid_match then
584585
index = q.full_name
585586
end
586587
if not udi[index].last_alerted then
587-
udi[index].last_alerted = GetServerTime()
588+
udi[index].last_alerted = timeNow
588589
return true
589590
end
590591

591592
local delta = self:get_opts_db().alert_lockout_seconds
592-
if GetServerTime() < delta + udi[index].last_alerted then
593-
local time_until = delta + udi[index].last_alerted - GetServerTime()
593+
if timeNow < delta + udi[index].last_alerted then
594+
local time_until = delta + udi[index].last_alerted - timeNow
594595
-- self:Print(string.format("locked out for another %f seconds", time_until))
595596
return false
596597
end
597-
udi[index].last_alerted = GetServerTime()
598+
udi[index].last_alerted = timeNow
598599
return true
599600
end
600601

0 commit comments

Comments
 (0)