Consolidate time format for API

Consolidate all the API to same time format: RFC3339, and it will be
client's responsibility to present it in more user friendly way.

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
Upstream-commit: 9daca1222adabf3aeae97a2c4e5f4ed1bb8c15e1
Component: engine
This commit is contained in:
Zhang Wei
2015-12-02 22:40:18 +08:00
parent 92e9c7bc6c
commit c529eb3ce9
4 changed files with 21 additions and 7 deletions
+11
View File
@@ -4,6 +4,7 @@ import (
"encoding/json"
"runtime"
"text/template"
"time"
"github.com/docker/docker/api"
"github.com/docker/docker/api/types"
@@ -72,6 +73,16 @@ func (cli *DockerCli) CmdVersion(args ...string) (err error) {
}
defer func() {
// first we need to make BuildTime more human friendly
t, errTime := time.Parse(time.RFC3339Nano, vd.Client.BuildTime)
if errTime == nil {
vd.Client.BuildTime = t.Format(time.ANSIC)
}
t, errTime = time.Parse(time.RFC3339Nano, vd.Server.BuildTime)
if errTime == nil {
vd.Server.BuildTime = t.Format(time.ANSIC)
}
if err2 := tmpl.Execute(cli.out, vd); err2 != nil && err == nil {
err = err2
}