Update On Fri Jul 11 20:40:25 CEST 2025

This commit is contained in:
github-action[bot]
2025-07-11 20:40:26 +02:00
parent e116426a2d
commit 4e5d06b4cd
44 changed files with 1644 additions and 912 deletions
@@ -1285,3 +1285,32 @@ function luci_types(id, m, s, type_name, option_prefix)
end
end
end
function format_go_time(input)
input = input and trim(input)
local N = 0
if input and input:match("^%d+$") then
N = tonumber(input)
elseif input and input ~= "" then
for value, unit in input:gmatch("(%d+)%s*([hms])") do
value = tonumber(value)
if unit == "h" then
N = N + value * 3600
elseif unit == "m" then
N = N + value * 60
elseif unit == "s" then
N = N + value
end
end
end
if N <= 0 then
return "0s"
end
local result = ""
local h = math.floor(N / 3600)
local m = math.floor(N % 3600 / 60)
local s = N % 60
if h > 0 then result = result .. h .. "h" end
if m > 0 then result = result .. m .. "m" end
if s > 0 or result == "" then result = result .. s .. "s" end
return result
end