MCPcopy Create free account
hub / github.com/buggregator/server / parseLogTimestamp

Function parseLogTimestamp

modules/sentry/store_log.go:72–86  ·  view source on GitHub ↗

parseLogTimestamp handles both float epoch seconds and string ISO timestamps.

(ts json.Number)

Source from the content-addressed store, hash-verified

70
71// parseLogTimestamp handles both float epoch seconds and string ISO timestamps.
72func parseLogTimestamp(ts json.Number) *string {
73 if ts == "" {
74 return nil
75 }
76
77 if f, err := strconv.ParseFloat(string(ts), 64); err == nil {
78 sec := int64(f)
79 nsec := int64((f - float64(sec)) * 1e9)
80 t := time.Unix(sec, nsec).UTC().Format(time.RFC3339Nano)
81 return &t
82 }
83
84 s := string(ts)
85 return &s
86}

Callers 1

storeLogsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected