sysutil.go 269 B

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