all repos — honk @ f18a3791f8cb77a0332a71c96cdd909db926445e

my fork of honk

humanize uptime
Anirudh Oppiliappan x@icyphox.sh
Tue, 15 Nov 2022 09:16:19 +0530
commit

f18a3791f8cb77a0332a71c96cdd909db926445e

parent

32f396b2fe8ab9505380710656140eed4852b694

2 files changed, 5 insertions(+), 3 deletions(-)

jump to
M sensors.gosensors.go

@@ -18,11 +18,13 @@

import ( "syscall" "time" + + "github.com/dustin/go-humanize" ) type Sensors struct { Memory float64 - Uptime float64 + Uptime string CPU float64 }

@@ -36,7 +38,7 @@ now := time.Now()

var sensors Sensors sensors.Memory = float64(usage.Maxrss) / 1024.0 - sensors.Uptime = now.Sub(boottime).Seconds() + sensors.Uptime = humanize.RelTime(boottime, now, "", "") sensors.CPU = time.Duration(usage.Utime.Nano()).Seconds() return sensors
M views/about.htmlviews/about.html

@@ -7,7 +7,7 @@ <table style="font-size:0.8em">

<tbody> <tr><td>version:<td style="text-align:right">{{ .HonkVersion }} <tr><td>memory:<td style="text-align:right">{{ printf "%.02f" .Sensors.Memory }}MB -<tr><td>uptime:<td style="text-align:right">{{ printf "%.02f" .Sensors.Uptime }}s +<tr><td>uptime:<td style="text-align:right">{{ .Sensors.Uptime }} <tr><td>cputime:<td style="text-align:right">{{ printf "%.02f" .Sensors.CPU }}s </table> <p>