luci-app-ddns: fix update time calculation
* Fix last_update overflow * Fix next_update wrong when the router is just started * Fix missing check_seconds for next_update Signed-off-by: Small_5 <61473216+small-5@users.noreply.github.com>
This commit is contained in:
parent
ade4abf539
commit
58ed2b211a
1 changed files with 5 additions and 5 deletions
|
@ -109,15 +109,15 @@ local methods = {
|
||||||
tonumber(s["force_interval"]) or 72,
|
tonumber(s["force_interval"]) or 72,
|
||||||
s["force_unit"] or "hours" )
|
s["force_unit"] or "hours" )
|
||||||
|
|
||||||
-- process running but update needs to happen
|
local check_seconds = calc_seconds(
|
||||||
-- problems if force_seconds > uptime
|
tonumber(s["check_interval"]) or 10,
|
||||||
force_seconds = (force_seconds > uptime) and uptime or force_seconds
|
s["check_unit"] or "minutes" )
|
||||||
|
|
||||||
if last_update > 0 then
|
if last_update > 0 then
|
||||||
local epoch = os.time() - uptime + last_update + force_seconds
|
local epoch = os.time() - uptime + last_update
|
||||||
-- use linux date to convert epoch
|
-- use linux date to convert epoch
|
||||||
converted_last_update = epoch2date(epoch,date_format)
|
converted_last_update = epoch2date(epoch,date_format)
|
||||||
next_update = epoch2date(epoch + force_seconds)
|
next_update = epoch2date(epoch + force_seconds + check_seconds)
|
||||||
end
|
end
|
||||||
|
|
||||||
if pid > 0 and ( last_update + force_seconds - uptime ) <= 0 then
|
if pid > 0 and ( last_update + force_seconds - uptime ) <= 0 then
|
||||||
|
|
Loading…
Reference in a new issue