// TimeBounds implements plan.BoundsAwareProcedureSpec.
766976
func (s *ReadRangePhysSpec) TimeBounds(predecessorBounds *plan.Bounds) *plan.Bounds {
	return &plan.Bounds{
		Start: values.ConvertTime(s.Bounds.Start.Time(s.Bounds.Now)),
		Stop:  values.ConvertTime(s.Bounds.Stop.Time(s.Bounds.Now)),
	}
}
523995
func calcTPS(count int, duration time.Duration) int {
	return int(float64(count) / (float64(duration) / float64(time.Second)))
}
206145
func (g *GeometryCollection) Bounds() *Bounds {
	// FIXME this needs work for mixing layouts, e.g. XYZ and XYM
	b := NewBounds(g.Layout())
	for _, g := range g.geoms {
		b = b.Extend(g)
	}
	return b
}
349084
func BoundedExponentialBackoff(baseSleepTime time.Duration, maxSleepTime time.Duration, maxRetries int) Policy {
	return boundedExponentialBackoff{
		exponentialBackoff: exponentialBackoff{
			baseSleepTime: baseSleepTime,
			maxRetries:    maxRetries,
		},
		maxSleepTime: maxSleepTime,
	}
}
1206229
func (s *HlsPackage) SetProgramDateTimeIntervalSeconds(v int64) *HlsPackage {
	s.ProgramDateTimeIntervalSeconds = &v
	return s
}
1350918
func NewBounds(layout Layout) *Bounds {
	stride := layout.Stride()
	min, max := make(Coord, stride), make(Coord, stride)
	for i := 0; i < stride; i++ {
		min[i], max[i] = math.Inf(1), math.Inf(-1)
	}
	return &Bounds{
		layout: layout,
		min:    min,
		max:    max,
	}
}
528203
func translateTimerAttributes(d time.Duration) (attrs map[string]interface{}) {
	attrs = make(map[string]interface{})
	attrs[DisplayTransform] = fmt.Sprintf("x/%d", int64(d))
	attrs[DisplayUnitsShort] = string(unitRegexp.Find([]byte(d.String())))
	return
}
350692
func (p Bits) Timestamps() []int64 {
	other := make([]int64, len(p))
	for i := range p {
		other[i] = p[i].Timestamp
	}
	return other
}
795857
func (e PrecisionTiming) durationToMs(x time.Duration) float64 {
	return float64(x) / float64(time.Millisecond)
}
205437
func (r *Request) Times(num int) *Request {
	r.Counter = num
	return r
}
439611
func (b *bdpEstimator) timesnap(d [8]byte) {
	if bdpPing.data != d {
		return
	}
	b.sentAt = time.Now()
}
984048
func NewTimerSet(g *GlobalContext) *TimerSet {
	s := g.Env.GetTimers()
	sel := TimerNone
	for _, c := range s {
		switch c {
		case 'a':
			sel |= TimerAPI
		case 'x':
			sel |= TimerXAPI
		case 'r':
			sel |= TimerRPC

		}
	}
	return &TimerSet{sel: sel, Contextified: Contextified{g}}
}
765059
func GetBounds(pid int32, args ...int) (int, int, int, int) {
	var hwnd int
	if len(args) > 0 {
		hwnd = args[0]

		return internalGetBounds(pid, hwnd)
	}

	xid, err := GetXId(xu, pid)
	if err != nil {
		log.Println("GetXidFromPid errors is: ", err)
		return 0, 0, 0, 0
	}

	return internalGetBounds(int32(xid), hwnd)
}
679112
func (s *DescribeRestoreJobOutput) SetExpectedCompletionTimeMinutes(v int64) *DescribeRestoreJobOutput {
	s.ExpectedCompletionTimeMinutes = &v
	return s
}
915943
func (g *GraphData) PurgeTimestamps() {
	if g == nil {
		return
	}
	for _, q := range g.Quests {
		q.PurgeTimestamps()
	}
}
1052109
func (s *CancelResizeOutput) SetEstimatedTimeToCompletionInSeconds(v int64) *CancelResizeOutput {
	s.EstimatedTimeToCompletionInSeconds = &v
	return s
}
698240
func (self *TimedStore) InTimeRange(start, end time.Time, maxResults int) []interface{} {
	// No stats, return empty.
	if len(self.buffer) == 0 {
		return []interface{}{}
	}

	var startIndex int
	if start.IsZero() {
		// None specified, start at the beginning.
		startIndex = len(self.buffer) - 1
	} else {
		// Start is the index before the elements smaller than it. We do this by
		// finding the first element smaller than start and taking the index
		// before that element
		startIndex = sort.Search(len(self.buffer), func(index int) bool {
			// buffer[index] < start
			return self.getData(index).timestamp.Before(start)
		}) - 1
		// Check if start is after all the data we have.
		if startIndex < 0 {
			return []interface{}{}
		}
	}

	var endIndex int
	if end.IsZero() {
		// None specified, end with the latest stats.
		endIndex = 0
	} else {
		// End is the first index smaller than or equal to it (so, not larger).
		endIndex = sort.Search(len(self.buffer), func(index int) bool {
			// buffer[index] <= t -> !(buffer[index] > t)
			return !self.getData(index).timestamp.After(end)
		})
		// Check if end is before all the data we have.
		if endIndex == len(self.buffer) {
			return []interface{}{}
		}
	}

	// Trim to maxResults size.
	numResults := startIndex - endIndex + 1
	if maxResults != -1 && numResults > maxResults {
		startIndex -= numResults - maxResults
		numResults = maxResults
	}

	// Return in sorted timestamp order so from the "back" to "front".
	result := make([]interface{}, numResults)
	for i := 0; i < numResults; i++ {
		result[i] = self.Get(startIndex - i)
	}
	return result
}