From dd98e703023225eacae9f3cf93ae92026686df5f Mon Sep 17 00:00:00 2001 From: Matej Vasek Date: Mon, 10 May 2021 10:17:04 +0200 Subject: fix: use UTC Time Stamps in response JSON Signed-off-by: Matej Vasek --- pkg/api/handlers/compat/containers.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'pkg/api/handlers/compat') diff --git a/pkg/api/handlers/compat/containers.go b/pkg/api/handlers/compat/containers.go index 263d64a7b..6bc02dd2b 100644 --- a/pkg/api/handlers/compat/containers.go +++ b/pkg/api/handlers/compat/containers.go @@ -379,6 +379,11 @@ func LibpodToContainerJSON(l *libpod.Container, sz bool) (*types.ContainerJSON, if err != nil { return nil, err } + // Docker uses UTC + if inspect != nil && inspect.State != nil { + inspect.State.StartedAt = inspect.State.StartedAt.UTC() + inspect.State.FinishedAt = inspect.State.FinishedAt.UTC() + } i, err := json.Marshal(inspect.State) if err != nil { return nil, err @@ -425,7 +430,7 @@ func LibpodToContainerJSON(l *libpod.Container, sz bool) (*types.ContainerJSON, cb := types.ContainerJSONBase{ ID: l.ID(), - Created: l.CreatedTime().Format(time.RFC3339Nano), + Created: l.CreatedTime().UTC().Format(time.RFC3339Nano), // Docker uses UTC Path: inspect.Path, Args: inspect.Args, State: &state, -- cgit v1.2.3-54-g00ecf