multiserver/uptime.go

18 lines
233 B
Go
Raw Normal View History

2021-03-06 11:33:25 -08:00
package main
import (
"math"
"time"
)
var uptime time.Time
// Uptime reports how long the program has been running
func Uptime() float64 {
return math.Floor(time.Since(uptime).Seconds())
}
func init() {
uptime = time.Now()
}