Index: go/src/infra/appengine/test-results/model/full_result.go |
diff --git a/go/src/infra/appengine/test-results/model/full_result.go b/go/src/infra/appengine/test-results/model/full_result.go |
index 0caebf7b5508369acd2c754f4691a730f201d27b..d99463cf5bddd5ef1d64b4fc42b2dd2a848d1f07 100644 |
--- a/go/src/infra/appengine/test-results/model/full_result.go |
+++ b/go/src/infra/appengine/test-results/model/full_result.go |
@@ -3,6 +3,7 @@ package model |
import ( |
"encoding/json" |
"errors" |
+ "math" |
"strings" |
) |
@@ -283,13 +284,20 @@ func (l *FullTestLeaf) AggregateTestLeaf() (AggregateTestLeaf, error) { |
var time float64 |
if l.Runtime != nil { |
- time = *l.Runtime |
+ time = float64(round(*l.Runtime)) |
} |
ret.Runtimes = []RuntimeSummary{{1, time}} |
return ret, nil |
} |
+func round(f float64) int { |
+ if math.Abs(f) < 0.5 { |
+ return 0 |
+ } |
+ return int(f + math.Copysign(0.5, f)) |
+} |
+ |
// MarshalJSON marshals l into JSON. |
func (l *FullTestLeaf) MarshalJSON() ([]byte, error) { |
aux := testResultAux{fullTestLeafAlias: (*fullTestLeafAlias)(l)} |