func TimeToMilliseconds(t time.Time) int64 {
	// Convert to seconds.
	sec := float64(t.Unix()) + float64(t.Nanosecond())/1e9

	// Parse seconds.
	s, ns := math.Modf(sec)

	// Round nanoseconds part.
	ns = math.Round(ns*1000) / 1000

	// Convert to millis.
	return (int64(s) * 1e3) + (int64(ns * 1e3))
}
// TimeToMilliseconds returns the input time as milliseconds, using the same
// formula used by Prometheus in order to get the same timestamp when asserting
// on query results. The formula we're mimicking here is Prometheus parseTime().
// See: https://github.com/prometheus/prometheus/blob/df80dc4d3970121f2f76cba79050983ffb3cdbb0/web/api/v1/api.go#L1690-L1694
TimeToMilliseconds returns the input time as milliseconds, using the same
formula used by Prometheus in order to get the same timestamp when asserting
on query results. The formula we're mimicking here is Prometheus parseTime().
// TimeToMilliseconds returns the input time as milliseconds using the same // formula used by Prometheus in order to get the same timestamp when asserting // on query results . The formula we ' re mimicking here is Prometheus parseTime () . // See : https : // github . com / prometheus / prometheus / blob / df80dc4d3970121f2f76cba79050983ffb3cdbb0 / web / api / v1 / api . go#L1690 - L1694
func TimeToMilliseconds(t time.Time) int64 {
	sec := float64(t.Unix()) + float64(t.Nanosecond())/1e9
	s, ns := math.Modf(sec)
	ns = math.Round(ns*1000) / 1000
	return (int64(s) * 1e3) + (int64(ns * 1e3))
}
func TimeToMilliseconds ( t time . Time ) int64 { sec := float64 ( t . Unix ( ) ) + float64 ( t . Nanosecond ( ) ) / 1e9 s , ns := math . Modf ( sec ) ns = math . Round ( ns * 1000 ) / 1000 return ( int64 ( s ) * 1e3 ) + ( int64 ( ns * 1e3 ) ) }
TimeToMilliseconds returns the input time as milliseconds, using the same
formula used by Prometheus in order to get the same timestamp when asserting
on query results.
TimeToMilliseconds returns the input time as milliseconds using the same formula used by Prometheus in order to get the same timestamp when asserting on query results .
// Convert to seconds. // Parse seconds. // Round nanoseconds part. // Convert to millis.