(s string)
| 1021 | } |
| 1022 | |
| 1023 | func parseSampleTimestampMs(s string) (int64, error) { |
| 1024 | f, err := parseOpenMetricsFloat(s) |
| 1025 | if err != nil { |
| 1026 | return 0, err |
| 1027 | } |
| 1028 | ms := math.Round(f * 1000) |
| 1029 | if math.IsNaN(ms) || math.IsInf(ms, 0) || ms < float64(math.MinInt64) || ms >= math.Exp2(63) { |
| 1030 | return 0, fmt.Errorf("invalid timestamp %v", f) |
| 1031 | } |
| 1032 | return int64(ms), nil |
| 1033 | } |
| 1034 | |
| 1035 | func parseTimestampToProto(s string) (*timestamppb.Timestamp, error) { |
| 1036 | if ts, ok := parseExactDecimalTimestamp(s); ok { |
no test coverage detected