sysutil.go 268 B

123456789101112131415
  1. package sysutil
  2. import "time"
  3. var btime time.Time
  4. // BootTime returns the time the system was started.
  5. func BootTime() time.Time {
  6. return btime
  7. }
  8. // Uptime returns the duration the system has been up.
  9. func Uptime() time.Duration {
  10. return time.Now().Sub(btime)
  11. }