MCPcopy
hub / github.com/moby/moby / parseTimestamp

Function parseTimestamp

client/internal/timestamp/timestamp.go:115–131  ·  view source on GitHub ↗
(value string)

Source from the content-addressed store, hash-verified

113}
114
115func parseTimestamp(value string) (seconds int64, nanoseconds int64, _ error) {
116 s, n, ok := strings.Cut(value, ".")
117 sec, err := strconv.ParseInt(s, 10, 64)
118 if err != nil {
119 return sec, 0, err
120 }
121 if !ok {
122 return sec, 0, nil
123 }
124 nsec, err := strconv.ParseInt(n, 10, 64)
125 if err != nil {
126 return sec, nsec, err
127 }
128 // should already be in nanoseconds but just in case convert n to nanoseconds
129 nsec = int64(float64(nsec) * math.Pow(float64(10), float64(9-len(n))))
130 return sec, nsec, nil
131}

Callers 2

GetTimestampFunction · 0.70
ParseTimestampsFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…