MCPcopy
hub / github.com/moby/moby / daemonTime

Function daemonTime

integration-cli/docker_utils_test.go:194–210  ·  view source on GitHub ↗

daemonTime provides the current time on the daemon host

(t *testing.T)

Source from the content-addressed store, hash-verified

192
193// daemonTime provides the current time on the daemon host
194func daemonTime(t *testing.T) time.Time {
195 t.Helper()
196 if testEnv.IsLocalDaemon() {
197 return time.Now()
198 }
199 apiClient, err := client.New(client.FromEnv)
200 assert.NilError(t, err)
201 defer apiClient.Close()
202
203 result, err := apiClient.Info(testutil.GetContext(t), client.InfoOptions{})
204 assert.NilError(t, err)
205 info := result.Info
206
207 dt, err := time.Parse(time.RFC3339Nano, info.SystemTime)
208 assert.Assert(t, err == nil, "invalid time format in GET /info response")
209 return dt
210}
211
212// daemonUnixTime returns the current time on the daemon host with nanoseconds precision.
213// It return the time formatted how the client sends timestamps to the server.

Callers 6

daemonUnixTimeFunction · 0.85
newEventObserverFunction · 0.85

Calls 6

GetContextFunction · 0.92
IsLocalDaemonMethod · 0.80
HelperMethod · 0.65
NewMethod · 0.65
CloseMethod · 0.65
InfoMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…