Fix unneccessary calculation to utc

This commit is contained in:
AliasAlreadyTaken 2024-04-17 18:52:30 +02:00
parent c5ed295d69
commit f2d9454d61
3 changed files with 4 additions and 4 deletions

View File

@ -142,7 +142,7 @@ function yl_scheduler.remove_task(UUID) return remove_task(UUID) end
local function clean_past_tasks()
local _, tasks = yl_scheduler.list_all_tasks()
local amount_deleted = 0
local current_utc_time = os.time(os.date("!*t")) -- utc
local current_utc_time = os.time() -- utc
for i = #tasks, 1, -1 do
if ((tasks[i].at ~= nil) and (tasks[i].at < current_utc_time)) then
@ -226,7 +226,7 @@ local function execute_task(UUID)
end
-- Change the done value in the file
local current_utc_time = os.time(os.date("!*t")) -- utc
local current_utc_time = os.time() -- utc
task.done = current_utc_time
yl_scheduler.save_json(UUID, task)

View File

@ -6,7 +6,7 @@ local gs = function(dtime)
timer = 0
local _, tasks = yl_scheduler.list_all_tasks()
local current_utc_time = os.time(os.date("!*t"))
local current_utc_time = os.time()
for _, task in ipairs(tasks) do
if (task.at < current_utc_time) and
((task.done == nil) or (task.done == -1)) then

View File

@ -132,7 +132,7 @@ local function validate_at(at)
return false, "at: No time given"
elseif type(at) ~= "number" then
return false, "at: Wrong type"
elseif at > os.time(os.date("!*t")) + (10 * 365 * 24 * 60 * 60) then
elseif at > os.time() + (10 * 365 * 24 * 60 * 60) then
return false, "at: Not within 10 years"
else
return true, "at: all good"