mirror of https://github.com/aredn/aredn.git
Format Uptime as String (#100)
* Format Uptime as String Format uptime as a string with values for days, hours, minutes, and seconds. * Format uptime as String Change code to use the secondsToClock function in utils.lua
This commit is contained in:
parent
209f9dc3f9
commit
8ef6e56925
|
@ -374,9 +374,9 @@ end
|
||||||
-- Current System Uptime
|
-- Current System Uptime
|
||||||
-------------------------------------
|
-------------------------------------
|
||||||
function model.getUptime()
|
function model.getUptime()
|
||||||
local mynix=nixio.sysinfo()
|
local mynix=nixio.sysinfo()
|
||||||
local upsecs=mynix['uptime']
|
local upsecs=mynix['uptime']
|
||||||
return upsecs
|
return secondsToClock(upsecs)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -481,7 +481,7 @@ function model.getDefaultGW()
|
||||||
end
|
end
|
||||||
|
|
||||||
-------------------------------------
|
-------------------------------------
|
||||||
-- Returns Table of current DHCP leases
|
-- Returns Table of current DHCP leases
|
||||||
-------------------------------------
|
-------------------------------------
|
||||||
function model.getCurrentDHCPLeases()
|
function model.getCurrentDHCPLeases()
|
||||||
local lines={}
|
local lines={}
|
||||||
|
@ -511,11 +511,11 @@ function model.getLocalHosts()
|
||||||
line = line:lower()
|
line = line:lower()
|
||||||
-- line is not a comment
|
-- line is not a comment
|
||||||
local data = line:match("^([^#;]+)[#;]*(.*)$")
|
local data = line:match("^([^#;]+)[#;]*(.*)$")
|
||||||
if data then
|
if data then
|
||||||
local hostname, entries
|
local hostname, entries
|
||||||
local ip, entries = data:match("^%s*([%[%]%x%.%:]+)%s+(%S.-%S)%s*$")
|
local ip, entries = data:match("^%s*([%[%]%x%.%:]+)%s+(%S.-%S)%s*$")
|
||||||
|
|
||||||
if ip then
|
if ip then
|
||||||
local entry = {
|
local entry = {
|
||||||
["ip"] = ip,
|
["ip"] = ip,
|
||||||
["hostnames"] = { }
|
["hostnames"] = { }
|
||||||
|
@ -543,4 +543,4 @@ function model.getMeshGatewaySetting()
|
||||||
return gw
|
return gw
|
||||||
end
|
end
|
||||||
|
|
||||||
return model
|
return model
|
||||||
|
|
Loading…
Reference in New Issue