// TimeSpan returns the total duration for which the data set.
519899
func (p *StoragePlan) TimeSpan() time.Duration {
	return p.EndTime.Sub(p.StartTime)
}
1066748
func (t *Timings) Time() int64 {
	t.mu.Lock()
	defer t.mu.Unlock()
	return t.totalTime
}
153161
func (j *Job) Duration() time.Duration {
	if j.Finished().IsZero() {
		return 0 * time.Second
	}
	return j.Finished().Sub(j.Started())
}
1319344
func NewSpan(inCtx context.Context, label string) (Span, context.Context) {
	parent, _ := spanFactory.FromContext(inCtx)
	span := spanFactory.New(parent, label)
	outCtx := spanFactory.NewContext(inCtx, span)

	return span, outCtx
}
800624
func (c *Client) Duration(name string, duration time.Duration) error {
	return c.send(name, 1, "%d|ms", millisecond(duration))
}
1019427
func Scale(o, d time.Duration) float64 {
	return float64(o) / float64(d)
}
736339
func (t *SimpleTrack) TimeDuration() time.Duration {
	return time.Duration(t.Duration) * time.Millisecond
}
41614
func (d DateTime) Timestamp(v reflect.Value) (interface{}, error) {
	return d.timestamp(), nil
}
1323160
func (ts *traceState) CreateSpan(desc string) (report ReportFunc) {
	ts.mu.Lock()
	defer ts.mu.Unlock()

	index := len(ts.spans)
	ts.spans = append(ts.spans, &span{desc: desc, start: time.Now()})

	report = func(err error) { ts.report(index, err) }
	return
}
417668
func (d Duration) Duration() (time.Duration, error) {
	switch {
	case byte(d) == 0x00:
		return time.Duration(0), nil
	case byte(d) <= 0x7F:
		return time.Duration(d) * time.Second, nil
	case d <= 0xFD:
		return time.Duration(d-0x7F) * time.Minute, nil
	}
	return time.Duration(0), fmt.Errorf("Factory default duration")
}
209105
func NewSpan(ctx context.Context, tracer opentracing.Tracer, name string) (context.Context, opentracing.Span) {
	span := opentracing.SpanFromContext(ctx)
	spanCtx := span.Context()
	span = tracer.StartSpan(name, opentracing.ChildOf(spanCtx))
	ctx = opentracing.ContextWithSpan(ctx, span)
	return ctx, span
}
492062
func (t *Track) Duration() time.Duration {
	ms := C.sp_track_duration(t.sp_track)
	return time.Duration(ms) * time.Millisecond
}
1100373
func (s *Sample) Duration() time.Duration {
	return s.End.Sub(s.Start)
}
1316227
func (d Duration) ConvertToTime(tp uint8) (Time, error) {
	year, month, day := gotime.Now().Date()
	// just use current year, month and day.
	n := gotime.Date(year, month, day, 0, 0, 0, 0, gotime.Local)
	n = n.Add(d.Duration)

	t := Time{
		Time: FromGoTime(n),
		Type: mysql.TypeDatetime,
		Fsp:  d.Fsp,
	}

	return t.Convert(tp)
}
1146853
func (v *Duration) Set(value time.Duration) {
	v.i.Set(value)
}
387515
func (fs *FlagSet) Duration(names []string, value time.Duration, usage string) *time.Duration {
	p := new(time.Duration)
	fs.DurationVar(p, names, value, usage)
	return p
}
1242155
func toTime(ts *timestamp.Timestamp) (result time.Time) {
	// We want a zero-ed out time.Time, not one set to the epoch.
	if t, err := ptypes.Timestamp(ts); err == nil {
		result = t
	}
	return
}