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:
Steve AB7PA 2021-05-05 20:20:29 -07:00 committed by GitHub
parent 209f9dc3f9
commit 8ef6e56925
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 7 deletions

View File

@ -374,9 +374,9 @@ end
-- Current System Uptime
-------------------------------------
function model.getUptime()
local mynix=nixio.sysinfo()
local upsecs=mynix['uptime']
return upsecs
local mynix=nixio.sysinfo()
local upsecs=mynix['uptime']
return secondsToClock(upsecs)
end
@ -481,7 +481,7 @@ function model.getDefaultGW()
end
-------------------------------------
-- Returns Table of current DHCP leases
-- Returns Table of current DHCP leases
-------------------------------------
function model.getCurrentDHCPLeases()
local lines={}
@ -511,11 +511,11 @@ function model.getLocalHosts()
line = line:lower()
-- line is not a comment
local data = line:match("^([^#;]+)[#;]*(.*)$")
if data then
if data then
local hostname, entries
local ip, entries = data:match("^%s*([%[%]%x%.%:]+)%s+(%S.-%S)%s*$")
if ip then
if ip then
local entry = {
["ip"] = ip,
["hostnames"] = { }
@ -543,4 +543,4 @@ function model.getMeshGatewaySetting()
return gw
end
return model
return model