We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0397086 commit 066d411Copy full SHA for 066d411
pkg/api/container.go
@@ -24,6 +24,20 @@ const (
24
25
type Container struct {
26
types.ContainerJSON
27
+ // created caches the parsed creation time by CreatedTime.
28
+ created time.Time
29
+}
30
+
31
+// CreatedTime returns the time when the container was created parsed from the Created field.
32
+func (c *Container) CreatedTime() time.Time {
33
+ if c.created.IsZero() {
34
+ created, err := time.Parse(time.RFC3339Nano, c.Created)
35
+ if err != nil {
36
+ return time.Time{}
37
+ }
38
+ c.created = created
39
40
+ return c.created
41
}
42
43
// Healthy determines if the container is running and healthy.
0 commit comments