Fix calculating uptime after system sleep (#4332)

* Fix calculating uptime after system sleep

* Update internal/clientcache/internal/daemon/status_handler.go

Co-authored-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>

---------

Co-authored-by: Johan Brandhorst-Satzkorn <johan.brandhorst@gmail.com>
pull/4338/head
Todd 2 years ago
parent ea1ec7a1a3
commit d6c9db968a

@ -123,7 +123,10 @@ func toApiStatus(in *cache.Status, started time.Time, socketAddr, logLocation st
}
out := &StatusResult{
Uptime: time.Since(started),
// Round(0) strips the monotonic clock from results which can drift
// by a wide degree from the wall clock in the case where the system
// sleeps.
Uptime: time.Since(started.Round(0)),
SocketAddress: socketAddr,
Version: version.Get().FullVersionNumber(true),
LogLocation: logLocation,

Loading…
Cancel
Save