Good call.


2013/4/24 juliusv <notifications@github.com>

> In model/metric.go:
>
> > @@ -136,6 +151,28 @@ func (v Values) InsideInterval(t time.Time) (s bool) {
> >  	return true
> >  }
> >
> > +// TruncateBefore returns a subslice of the original such that extraneous
> > +// samples in the collection that occur before the provided time are
> > +// dropped.  The original slice is not mutated.
> > +func (v Values) TruncateBefore(t time.Time) (values Values) {
> > +	index := sort.Search(len(v), func(i int) bool {
> > +		timestamp := v[i].Timestamp
> > +
> > +		return timestamp.After(t) || timestamp.Equal(t)
>
> return !timestamp.Before(t) would be faster, though maybe slightly less
> readable.
>
> —
> Reply to this email directly or view it on GitHub<https://github.com/prometheus/prometheus/pull/176/files#r3933520>
> .
>