Fix uptime being inaccurate.
All checks were successful
Build and push container image / build (push) Successful in 39s

This commit is contained in:
toast 2023-10-25 10:54:13 +11:00
parent e41be91a4c
commit bfe787b632

View File

@ -1,9 +1,6 @@
package toolbox package toolbox
import ( import "time"
"fmt"
"time"
)
/* /*
System/OS-related utilities such as uptime. System/OS-related utilities such as uptime.
@ -18,10 +15,5 @@ var timerStart = time.Now()
func GetUptime() string { func GetUptime() string {
uptime := time.Since(timerStart) uptime := time.Since(timerStart)
roundedUp := uptime.Round(time.Second) roundedUp := uptime.Round(time.Second)
days := roundedUp / (24 * time.Hour)
hours := roundedUp % (24 * time.Hour) / time.Hour
if days > 0 {
return fmt.Sprintf("%dd,%dh", days, hours)
}
return roundedUp.String() return roundedUp.String()
} }