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>
(cherry picked from commit 58ed2b211a
)
This commit is contained in:
parent
a993714790
commit
9139ad4685
1 changed files with 5 additions and 5 deletions
|
@ -109,15 +109,15 @@ local methods = {
|
|||
tonumber(s["force_interval"]) or 72,
|
||||
s["force_unit"] or "hours" )
|
||||
|
||||
-- process running but update needs to happen
|
||||
-- problems if force_seconds > uptime
|
||||
force_seconds = (force_seconds > uptime) and uptime or force_seconds
|
||||
local check_seconds = calc_seconds(
|
||||
tonumber(s["check_interval"]) or 10,
|
||||
s["check_unit"] or "minutes" )
|
||||
|
||||
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
|
||||
converted_last_update = epoch2date(epoch,date_format)
|
||||
next_update = epoch2date(epoch + force_seconds)
|
||||
next_update = epoch2date(epoch + force_seconds + check_seconds)
|
||||
end
|
||||
|
||||
if pid > 0 and ( last_update + force_seconds - uptime ) <= 0 then
|
||||
|
|
Loading…
Reference in a new issue