mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-09-04 16:23:21 +00:00
fix(cron): fix unused args
This commit is contained in:
@@ -13,20 +13,18 @@ function GetUnixTimestamp()
|
||||
return os.time()
|
||||
end
|
||||
|
||||
function OnTime(h, m)
|
||||
local currentTimestamp = GetUnixTimestamp()
|
||||
|
||||
function OnTime(time)
|
||||
for i = 1, #Jobs, 1 do
|
||||
local scheduledTimestamp = os.time({
|
||||
hour = Jobs[i].h,
|
||||
minute = Jobs[i].m,
|
||||
second = 0, -- Assuming tasks run at the start of the minute
|
||||
day = os.date('%d', currentTimestamp),
|
||||
month = os.date('%m', currentTimestamp),
|
||||
year = os.date('%Y', currentTimestamp)
|
||||
day = os.date('%d', time),
|
||||
month = os.date('%m', time),
|
||||
year = os.date('%Y', time)
|
||||
})
|
||||
|
||||
if currentTimestamp >= scheduledTimestamp and (not LastTime or LastTime < scheduledTimestamp) then
|
||||
if time >= scheduledTimestamp and (not LastTime or LastTime < scheduledTimestamp) then
|
||||
Jobs[i].cb(Jobs[i].h, Jobs[i].m)
|
||||
end
|
||||
end
|
||||
@@ -36,7 +34,7 @@ function Tick()
|
||||
local time = GetUnixTimestamp()
|
||||
|
||||
if not LastTime or os.date('%M', time) ~= os.date('%M', LastTime) then
|
||||
OnTime(os.date('%H', time), os.date('%M', time))
|
||||
OnTime(time)
|
||||
LastTime = time
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user