Merge pull request #11706 from HuKeping/time

Fix inconsistent date formats in API
This commit is contained in:
Sebastiaan van Stijn
2015-05-13 20:23:19 -07:00
10 changed files with 135 additions and 22 deletions
+2 -2
View File
@@ -47,9 +47,9 @@ func (cli *DockerCli) CmdHistory(args ...string) error {
}
if !*quiet {
if *human {
fmt.Fprintf(w, "\t%s ago\t", units.HumanDuration(time.Now().UTC().Sub(time.Unix(entry.Created, 0))))
fmt.Fprintf(w, "\t%s ago\t", units.HumanDuration(time.Now().UTC().Sub(entry.Created)))
} else {
fmt.Fprintf(w, "\t%s\t", time.Unix(entry.Created, 0).Format(time.RFC3339))
fmt.Fprintf(w, "\t%s\t", entry.Created.Format(time.RFC3339))
}
if *noTrunc {
+2 -2
View File
@@ -109,9 +109,9 @@ func (cli *DockerCli) CmdImages(args ...string) error {
if !*quiet {
if *showDigests {
fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s ago\t%s\n", repo, tag, digest, ID, units.HumanDuration(time.Now().UTC().Sub(time.Unix(int64(image.Created), 0))), units.HumanSize(float64(image.VirtualSize)))
fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s ago\t%s\n", repo, tag, digest, ID, units.HumanDuration(time.Now().UTC().Sub(image.Created)), units.HumanSize(float64(image.VirtualSize)))
} else {
fmt.Fprintf(w, "%s\t%s\t%s\t%s ago\t%s\n", repo, tag, ID, units.HumanDuration(time.Now().UTC().Sub(time.Unix(int64(image.Created), 0))), units.HumanSize(float64(image.VirtualSize)))
fmt.Fprintf(w, "%s\t%s\t%s\t%s ago\t%s\n", repo, tag, ID, units.HumanDuration(time.Now().UTC().Sub(image.Created)), units.HumanSize(float64(image.VirtualSize)))
}
} else {
fmt.Fprintln(w, ID)
+1 -1
View File
@@ -151,7 +151,7 @@ func (cli *DockerCli) CmdPs(args ...string) error {
}
fmt.Fprintf(w, "%s\t%s\t%s\t%s ago\t%s\t%s\t%s\t", ID, image, command,
units.HumanDuration(time.Now().UTC().Sub(time.Unix(int64(container.Created), 0))),
units.HumanDuration(time.Now().UTC().Sub(container.Created)),
container.Status, api.DisplayablePorts(container.Ports), strings.Join(names, ","))
if *size {