mirror of
https://github.com/clearlinux/docker.git
synced 2026-09-05 13:11:30 +00:00
Add system time to /info
This change adds daemon's system time as RFC3339Nano to the `/info` endpoint and shows in a more readable format (UnixDate) in `docker -D info` output. I will be using this to fix the clock skew between the remote test host and the CI machines running `docker events`-related tests as they're using `--since` and `--until` and the timestamps are not matching when daemon is not on the same machine. Signed-off-by: Ahmet Alp Balkan <ahmetalpbalkan@gmail.com>
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"io"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/docker/docker/utils"
|
||||
)
|
||||
@@ -69,6 +70,15 @@ func (env *Env) SetBool(key string, value bool) {
|
||||
}
|
||||
}
|
||||
|
||||
func (env *Env) GetTime(key string) (time.Time, error) {
|
||||
t, err := time.Parse(time.RFC3339Nano, env.Get(key))
|
||||
return t, err
|
||||
}
|
||||
|
||||
func (env *Env) SetTime(key string, t time.Time) {
|
||||
env.Set(key, t.Format(time.RFC3339Nano))
|
||||
}
|
||||
|
||||
func (env *Env) GetInt(key string) int {
|
||||
return int(env.GetInt64(key))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user