summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/podman/containers/ps.go7
-rw-r--r--pkg/domain/entities/container_ps.go2
2 files changed, 8 insertions, 1 deletions
diff --git a/cmd/podman/containers/ps.go b/cmd/podman/containers/ps.go
index ffd2054a6..5d3c9263e 100644
--- a/cmd/podman/containers/ps.go
+++ b/cmd/podman/containers/ps.go
@@ -110,7 +110,12 @@ func checkFlags(c *cobra.Command) error {
}
func jsonOut(responses []entities.ListContainer) error {
- b, err := json.MarshalIndent(responses, "", " ")
+ r := make([]entities.ListContainer, 0)
+ for _, con := range responses {
+ con.CreatedAt = units.HumanDuration(time.Since(time.Unix(con.Created, 0))) + " ago"
+ r = append(r, con)
+ }
+ b, err := json.MarshalIndent(r, "", " ")
if err != nil {
return err
}
diff --git a/pkg/domain/entities/container_ps.go b/pkg/domain/entities/container_ps.go
index c5e11f188..05627c4b3 100644
--- a/pkg/domain/entities/container_ps.go
+++ b/pkg/domain/entities/container_ps.go
@@ -15,6 +15,8 @@ type ListContainer struct {
Command []string
// Container creation time
Created int64
+ // Human readable container creation time.
+ CreatedAt string
// If container has exited/stopped
Exited bool
// Time container exited