func()

in timestamped_metric.go [44:63]


func (m *TimestampedMetric) ensureTimestamp(timestamp *time.Time) time.Time {
	if m.vec == nil {
		// back-fill a pseudo vector if needed
		m.vec = &TimestampedMetricVec{}
	}
	if m.vec.timestamp == nil {
		m.vec.timestamp = new(time.Time)
		if timestamp != nil {
			*(m.vec.timestamp) = *timestamp
		}
		return *(m.vec.timestamp)
	}
	if timestamp == nil {
		return *(m.vec.timestamp)
	}
	if m.vec.timestamp.Before(*timestamp) {
		*(m.vec.timestamp) = *timestamp
	}
	return *(m.vec.timestamp)
}