Browse code

State: Keep track of the container start time

Andrea Luzzardi authored on 2013/01/23 08:03:27
Showing 1 changed files
... ...
@@ -2,12 +2,14 @@ package docker
2 2
 
3 3
 import (
4 4
 	"sync"
5
+	"time"
5 6
 )
6 7
 
7 8
 type State struct {
8 9
 	Running  bool
9 10
 	Pid      int
10 11
 	ExitCode int
12
+	StartedAt time.Time
11 13
 
12 14
 	stateChangeLock *sync.Mutex
13 15
 	stateChangeCond *sync.Cond
... ...
@@ -25,6 +27,7 @@ func (s *State) setRunning(pid int) {
25 25
 	s.Running = true
26 26
 	s.ExitCode = 0
27 27
 	s.Pid = pid
28
+	s.StartedAt = time.Now()
28 29
 	s.broadcast()
29 30
 }
30 31