v0.0.586
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 2m33s
All checks were successful
Build Docker and Deploy / Run goext test-suite (push) Successful in 2m33s
This commit is contained in:
@@ -148,12 +148,16 @@ func Avg(v ...time.Time) time.Time {
|
||||
return time.Time{}
|
||||
}
|
||||
|
||||
var sum int64
|
||||
t0 := v[0].UnixNano()
|
||||
|
||||
var dsum int64
|
||||
for _, t := range v {
|
||||
sum += t.UnixNano()
|
||||
dsum += t.UnixNano() - t0
|
||||
}
|
||||
|
||||
return time.Unix(0, sum/int64(len(v)))
|
||||
tAvg := t0 + (dsum / int64(len(v)))
|
||||
|
||||
return time.Unix(0, tAvg)
|
||||
}
|
||||
|
||||
func Median(v ...time.Time) time.Time {
|
||||
|
Reference in New Issue
Block a user