grafana/pkg/metrics/delta.go

12 lines
225 B
Go
Raw Normal View History

2016-06-03 08:06:57 -05:00
package metrics
import "math"
func calculateDelta(oldValue, newValue int64) int64 {
if oldValue < newValue {
return newValue - oldValue
} else {
return (math.MaxInt64 - oldValue) + (newValue - math.MinInt64) + 1
}
}