diff options
author | Lars Karlitski <lars@karlitski.net> | 2019-02-04 18:56:41 +0100 |
---|---|---|
committer | Lars Karlitski <lars@karlitski.net> | 2019-02-12 14:47:49 +0100 |
commit | 29392b77e90b59e6f7b7d78db78c9c0ae045bc06 (patch) | |
tree | 74f6465ab04f1e2bb2248b67ff06a566c0c3e9b9 /libpod/adapter | |
parent | 38e42476cba14515cd2dbc53318ff1882a94b1c5 (diff) | |
download | podman-29392b77e90b59e6f7b7d78db78c9c0ae045bc06.tar.gz podman-29392b77e90b59e6f7b7d78db78c9c0ae045bc06.tar.bz2 podman-29392b77e90b59e6f7b7d78db78c9c0ae045bc06.zip |
varlink: Return all times in RFC 3339 format
This is more consistent and eaiser to parse than the format that
golang's time.String() returns.
Fixes #2260
Signed-off-by: Lars Karlitski <lars@karlitski.net>
Diffstat (limited to 'libpod/adapter')
-rw-r--r-- | libpod/adapter/runtime_remote.go | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/libpod/adapter/runtime_remote.go b/libpod/adapter/runtime_remote.go index 4dfae34e1..644802909 100644 --- a/libpod/adapter/runtime_remote.go +++ b/libpod/adapter/runtime_remote.go @@ -6,7 +6,6 @@ import ( "bufio" "context" "encoding/json" - "fmt" "github.com/pkg/errors" "io" "os" @@ -113,7 +112,7 @@ func (r *LocalRuntime) GetImages() ([]*ContainerImage, error) { } func imageInListToContainerImage(i iopodman.ImageInList, name string, runtime *LocalRuntime) (*ContainerImage, error) { - created, err := splitStringDate(i.Created) + created, err := time.ParseInLocation(time.RFC3339, i.Created, time.UTC) if err != nil { return nil, err } @@ -182,12 +181,6 @@ func (r *LocalRuntime) New(ctx context.Context, name, signaturePolicyPath, authf return newImage, nil } -func splitStringDate(d string) (time.Time, error) { - fields := strings.Fields(d) - t := fmt.Sprintf("%sT%sZ", fields[0], fields[1]) - return time.ParseInLocation(time.RFC3339Nano, t, time.UTC) -} - // IsParent goes through the layers in the store and checks if i.TopLayer is // the parent of any other layer in store. Double check that image with that // layer exists as well. @@ -251,7 +244,7 @@ func (ci *ContainerImage) History(ctx context.Context) ([]*image.History, error) return nil, err } for _, h := range reply { - created, err := splitStringDate(h.Created) + created, err := time.ParseInLocation(time.RFC3339, h.Created, time.UTC) if err != nil { return nil, err } |