浏览代码

State: Keep track of the container start time

Andrea Luzzardi 12 年之前
父节点
当前提交
64fc86fba7
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      state.go

+ 3 - 0
state.go

@@ -2,12 +2,14 @@ package docker
 
 import (
 	"sync"
+	"time"
 )
 
 type State struct {
 	Running  bool
 	Pid      int
 	ExitCode int
+	StartedAt time.Time
 
 	stateChangeLock *sync.Mutex
 	stateChangeCond *sync.Cond
@@ -25,6 +27,7 @@ func (s *State) setRunning(pid int) {
 	s.Running = true
 	s.ExitCode = 0
 	s.Pid = pid
+	s.StartedAt = time.Now()
 	s.broadcast()
 }