Hello Admin
is there a chance that the schedule script miss the table time so the execution occurs before or after the desired time?
another question, I am trying to compare real time with the table time e.g. if nowTime (>,<,=) tableTime[Y] (+-) X then do something
Edit: This is what I did, any advice admin?
is there a chance that the schedule script miss the table time so the execution occurs before or after the desired time?
another question, I am trying to compare real time with the table time e.g. if nowTime (>,<,=) tableTime[Y] (+-) X then do something
Edit: This is what I did, any advice admin?
Code:
dtbl = os.date('*t')
date = string.format('%d/%d', dtbl.day, dtbl.month)
time = string.format('%d:%02d', dtbl.hour, dtbl.min)
timeNum = (dtbl.hour-y)*60 + (dtbl.min-x) -- current time in minutes
c = 0 -- to know active table time (active pray)
schedtimes = schedule[ date ] or {}
for _, schedtime in ipairs(schedtimes) do
c=c+1
prayTimeAry = string.split(schedtime, ':')
prayNum = tonumber(prayTimeAry[1]*60) + tonumber(prayTimeAry[2])
if (prayNum - timeNum ) == 1 then ----edit
log ("amplifier CMD")
elseif schedtime == time then
log ('Azan CMD')
-- grp.write('1/0/37',true)
elseif (timeNum - prayNum) == 6 then
log("Turn OFF System")
end
end
Best Regards,