Evacuate data appropriately

this breaks the tests; tests need to not rely on some weird date in the past.
This commit is contained in:
Stephen McQuay 2014-03-03 23:14:15 -08:00
parent 63547f2d37
commit c33a5561bb

View File

@ -128,8 +128,9 @@ func (s *stream) averages() []float64 {
if s.data.Back() == nil {
return totals
}
newest := s.data.Back().Value.(datum)
cutoff := newest.at.Add(s.max)
now := time.Now()
cutoff := now.Add(s.max)
for e := s.data.Front(); e != nil; e = e.Next() {
cur := e.Value.(datum).at
if cur.Before(cutoff) {
@ -142,7 +143,7 @@ func (s *stream) averages() []float64 {
e := s.data.Back()
for _, extent := range s.extents {
limit = newest.at.Add(extent)
limit = now.Add(extent)
for ; e != nil; e = e.Prev() {
if e.Prev() == nil {
break