all repos — honk @ a24ebec06cb9dd8c17eadf5ca5ad5af0daec733d

my fork of honk

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

a24ebec06cb9dd8c17eadf5ca5ad5af0daec733d

parent

86c8c2491ead3ddc263c173af21c7ddf5f668f0e

2 files changed, 8 insertions(+), 6 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

@@ -5,10 +5,10 @@ {{ .AboutMsg }}

<p> <table class="font08em"> <tbody> -<tr><td>version:<td class="textright">{{ .HonkVersion }} -<tr><td>memory:<td class="textright">{{ printf "%.02f" .Sensors.Memory }}MB -<tr><td>uptime:<td class="textright">{{ printf "%.02f" .Sensors.Uptime }}s -<tr><td>cputime:<td class="textright">{{ printf "%.02f" .Sensors.CPU }}s +<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">{{ .Sensors.Uptime }} +<tr><td>cputime:<td style="text-align:right">{{ printf "%.02f" .Sensors.CPU }}s </table> <p> </div>