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/4342/head
Todd 2 years ago committed by GitHub
parent c3e49fa337
commit 278f23c9d4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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