Adding a verbose time option to output formatted timestamps

Fixes #11413

Signed-off-by: Dave Henderson <Dave.Henderson@ca.ibm.com>
Upstream-commit: dcff07d03d9accbedd2467fe9c7c10fba7c2b35c
Component: engine
This commit is contained in:
Dave Henderson
2015-04-07 20:37:36 -04:00
committed by Arnaud Porterie
parent 94c3eb9bd3
commit 8b3da7ead2

View File

@ -46,11 +46,11 @@ func (cli *DockerCli) CmdHistory(args ...string) error {
fmt.Fprintf(w, stringid.TruncateID(entry.ID))
}
if !*quiet {
fmt.Fprintf(w, "\t%s ago\t", units.HumanDuration(time.Now().UTC().Sub(time.Unix(entry.Created, 0))))
if *noTrunc {
fmt.Fprintf(w, "\t%s\t", time.Unix(entry.Created, 0).Format(time.RFC3339))
fmt.Fprintf(w, "%s\t", entry.CreatedBy)
} else {
fmt.Fprintf(w, "\t%s ago\t", units.HumanDuration(time.Now().UTC().Sub(time.Unix(entry.Created, 0))))
fmt.Fprintf(w, "%s\t", stringutils.Truncate(entry.CreatedBy, 45))
}
fmt.Fprintf(w, "%s\t", units.HumanSize(float64(entry.Size)))