mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #18309 from WeiZhang555/time
Consolidate time format for API
This commit is contained in:
commit
6deec021e5
4 changed files with 21 additions and 7 deletions
|
@ -4,6 +4,7 @@ import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"runtime"
|
"runtime"
|
||||||
"text/template"
|
"text/template"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/docker/docker/api"
|
"github.com/docker/docker/api"
|
||||||
"github.com/docker/docker/api/types"
|
"github.com/docker/docker/api/types"
|
||||||
|
@ -72,6 +73,16 @@ func (cli *DockerCli) CmdVersion(args ...string) (err error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
defer func() {
|
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 {
|
if err2 := tmpl.Execute(cli.out, vd); err2 != nil && err == nil {
|
||||||
err = err2
|
err = err2
|
||||||
}
|
}
|
||||||
|
|
|
@ -99,6 +99,8 @@ This section lists each version from latest to oldest. Each listing includes a
|
||||||
* `GET /info` Now returns `Architecture` and `OSType` fields, providing information
|
* `GET /info` Now returns `Architecture` and `OSType` fields, providing information
|
||||||
about the host architecture and operating system type that the daemon runs on.
|
about the host architecture and operating system type that the daemon runs on.
|
||||||
* `GET /networks/(name)` now returns a `Name` field for each container attached to the network.
|
* `GET /networks/(name)` now returns a `Name` field for each container attached to the network.
|
||||||
|
* `GET /version` now returns the `BuildTime` field in RFC3339Nano format to make it
|
||||||
|
consistent with other date/time values returned by the API.
|
||||||
|
|
||||||
### v1.21 API changes
|
### v1.21 API changes
|
||||||
|
|
||||||
|
|
|
@ -1994,14 +1994,15 @@ Show the docker version information
|
||||||
Content-Type: application/json
|
Content-Type: application/json
|
||||||
|
|
||||||
{
|
{
|
||||||
"Version": "1.5.0",
|
"Version": "1.10.0-dev",
|
||||||
"Os": "linux",
|
"Os": "linux",
|
||||||
"KernelVersion": "3.18.5-tinycore64",
|
"KernelVersion": "3.19.0-23-generic",
|
||||||
"GoVersion": "go1.4.1",
|
"GoVersion": "go1.4.2",
|
||||||
"GitCommit": "a8a31ef",
|
"GitCommit": "e75da4b",
|
||||||
"Arch": "amd64",
|
"Arch": "amd64",
|
||||||
"ApiVersion": "1.20",
|
"ApiVersion": "1.22",
|
||||||
"Experimental": false
|
"BuildTime": "2015-12-01T07:09:13.444803460+00:00",
|
||||||
|
"Experimental": true
|
||||||
}
|
}
|
||||||
|
|
||||||
Status Codes:
|
Status Codes:
|
||||||
|
|
|
@ -70,7 +70,7 @@ if command -v git &> /dev/null && git rev-parse &> /dev/null; then
|
||||||
if [ -n "$(git status --porcelain --untracked-files=no)" ]; then
|
if [ -n "$(git status --porcelain --untracked-files=no)" ]; then
|
||||||
GITCOMMIT="$GITCOMMIT-dirty"
|
GITCOMMIT="$GITCOMMIT-dirty"
|
||||||
fi
|
fi
|
||||||
BUILDTIME=$(date -u)
|
BUILDTIME=$(date --rfc-3339 ns | sed -e 's/ /T/')
|
||||||
elif [ "$DOCKER_GITCOMMIT" ]; then
|
elif [ "$DOCKER_GITCOMMIT" ]; then
|
||||||
GITCOMMIT="$DOCKER_GITCOMMIT"
|
GITCOMMIT="$DOCKER_GITCOMMIT"
|
||||||
else
|
else
|
||||||
|
|
Loading…
Add table
Reference in a new issue