func parseToTimestamp()

in action/log/logadapter/loki.go [95:111]


func parseToTimestamp(timeStr string) (int64, error) {
	// Load the specified time zone (UTC in this case)
	loc, err := time.LoadLocation("UTC")
	if err != nil {
		return 0, fmt.Errorf("failed to load timezone: %v", err)
	}

	// Parse the time string using the specified layout and timezone
	t, err := time.ParseInLocation(TimeLayout, timeStr, loc)
	if err != nil {
		return 0, fmt.Errorf("failed to parse time: %v", err)
	}

	// Convert to Unix nanosecond timestamp
	timestamp := t.UnixNano()
	return timestamp, nil
}