summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJP Sugarbroad <taralx@gmail.com>2019-11-08 21:24:43 +0000
committerBrad Fitzpatrick <bradfitz@golang.org>2019-11-09 02:19:31 +0000
commitdaa7c04131f568e31c51927b359a2d197a357058 (patch)
tree68b488e8767aef22cd40aab1e1234269de32d328
parentc7154b74f18f62a42612a96ebd5389bf9dea7a56 (diff)
downloadnet-master.tar.xz
internal/timeseries: avoid storing numbers as durationsHEADmaster
... even if it does avoid a cast. advance isn't a duration and shouldn't be typed that way. Change-Id: I6328188e74010d6c57adf5b26beede57b3bc7e33 GitHub-Last-Rev: 281097649e15c343e72cc51ecbeda31e81f9b6b3 GitHub-Pull-Request: golang/net#29 Reviewed-on: https://go-review.googlesource.com/c/net/+/161297 Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
-rw-r--r--internal/timeseries/timeseries.go6
1 files changed, 3 insertions, 3 deletions
diff --git a/internal/timeseries/timeseries.go b/internal/timeseries/timeseries.go
index 685f0e7..dc5225b 100644
--- a/internal/timeseries/timeseries.go
+++ b/internal/timeseries/timeseries.go
@@ -403,9 +403,9 @@ func (ts *timeSeries) extract(l *tsLevel, start, finish time.Time, num int, resu
// Where should scanning start?
if dstStart.After(srcStart) {
- advance := dstStart.Sub(srcStart) / srcInterval
- srcIndex += int(advance)
- srcStart = srcStart.Add(advance * srcInterval)
+ advance := int(dstStart.Sub(srcStart) / srcInterval)
+ srcIndex += advance
+ srcStart = srcStart.Add(time.Duration(advance) * srcInterval)
}
// The i'th value is computed as show below.