MCPcopy Index your code
hub / github.com/docker/docker-agent / parseEventTimestamp

Function parseEventTimestamp

pkg/evaluation/save.go:361–370  ·  view source on GitHub ↗

parseEventTimestamp extracts the timestamp from an event map. Returns the timestamp string, falling back to current time if not present or invalid.

(event map[string]any)

Source from the content-addressed store, hash-verified

359// parseEventTimestamp extracts the timestamp from an event map.
360// Returns the timestamp string, falling back to current time if not present or invalid.
361func parseEventTimestamp(event map[string]any) string {
362 if ts, ok := event["timestamp"].(string); ok && ts != "" {
363 // Validate RFC3339 format
364 if _, err := time.Parse(time.RFC3339, ts); err == nil {
365 return ts
366 }
367 // Invalid timestamp format - fall back to current time
368 }
369 return time.Now().Format(time.RFC3339)
370}
371
372// SaveRunJSON saves the eval run results to a JSON file.
373// This is kept for backward compatibility and debugging purposes.

Callers 1

SessionFromEventsFunction · 0.85

Calls 2

ParseMethod · 0.80
NowMethod · 0.80

Tested by

no test coverage detected