Merge pull request #192 from feiskyer/timestamps

Set timestamps to nanoseconds
This commit is contained in:
Mrunal Patel 2016-11-14 09:33:01 -08:00 committed by GitHub
commit 8d275cebb9
2 changed files with 9 additions and 9 deletions

View file

@ -490,7 +490,7 @@ func (s *Server) ListContainers(ctx context.Context, req *pb.ListContainersReque
podSandboxID := ctr.Sandbox() podSandboxID := ctr.Sandbox()
cState := s.runtime.ContainerStatus(ctr) cState := s.runtime.ContainerStatus(ctr)
created := cState.Created.Unix() created := cState.Created.UnixNano()
rState := pb.ContainerState_UNKNOWN rState := pb.ContainerState_UNKNOWN
cID := ctr.ID() cID := ctr.ID()
@ -551,21 +551,21 @@ func (s *Server) ContainerStatus(ctx context.Context, req *pb.ContainerStatusReq
switch cState.Status { switch cState.Status {
case oci.ContainerStateCreated: case oci.ContainerStateCreated:
rStatus = pb.ContainerState_CREATED rStatus = pb.ContainerState_CREATED
created := cState.Created.Unix() created := cState.Created.UnixNano()
resp.Status.CreatedAt = int64Ptr(created) resp.Status.CreatedAt = int64Ptr(created)
case oci.ContainerStateRunning: case oci.ContainerStateRunning:
rStatus = pb.ContainerState_RUNNING rStatus = pb.ContainerState_RUNNING
created := cState.Created.Unix() created := cState.Created.UnixNano()
resp.Status.CreatedAt = int64Ptr(created) resp.Status.CreatedAt = int64Ptr(created)
started := cState.Started.Unix() started := cState.Started.UnixNano()
resp.Status.StartedAt = int64Ptr(started) resp.Status.StartedAt = int64Ptr(started)
case oci.ContainerStateStopped: case oci.ContainerStateStopped:
rStatus = pb.ContainerState_EXITED rStatus = pb.ContainerState_EXITED
created := cState.Created.Unix() created := cState.Created.UnixNano()
resp.Status.CreatedAt = int64Ptr(created) resp.Status.CreatedAt = int64Ptr(created)
started := cState.Started.Unix() started := cState.Started.UnixNano()
resp.Status.StartedAt = int64Ptr(started) resp.Status.StartedAt = int64Ptr(started)
finished := cState.Finished.Unix() finished := cState.Finished.UnixNano()
resp.Status.FinishedAt = int64Ptr(finished) resp.Status.FinishedAt = int64Ptr(finished)
resp.Status.ExitCode = int32Ptr(cState.ExitCode) resp.Status.ExitCode = int32Ptr(cState.ExitCode)
} }

View file

@ -454,7 +454,7 @@ func (s *Server) PodSandboxStatus(ctx context.Context, req *pb.PodSandboxStatusR
} }
cState := s.runtime.ContainerStatus(podInfraContainer) cState := s.runtime.ContainerStatus(podInfraContainer)
created := cState.Created.Unix() created := cState.Created.UnixNano()
netNsPath, err := podInfraContainer.NetNsPath() netNsPath, err := podInfraContainer.NetNsPath()
if err != nil { if err != nil {
@ -545,7 +545,7 @@ func (s *Server) ListPodSandbox(ctx context.Context, req *pb.ListPodSandboxReque
return nil, err return nil, err
} }
cState := s.runtime.ContainerStatus(podInfraContainer) cState := s.runtime.ContainerStatus(podInfraContainer)
created := cState.Created.Unix() created := cState.Created.UnixNano()
rStatus := pb.PodSandBoxState_NOTREADY rStatus := pb.PodSandBoxState_NOTREADY
if cState.Status == oci.ContainerStateRunning { if cState.Status == oci.ContainerStateRunning {
rStatus = pb.PodSandBoxState_READY rStatus = pb.PodSandBoxState_READY