// AddElapsedSince adds the duration since the reference time to the given named stopwatch.
975565
func (ns *NamedStopwatch) AddElapsedSince(name string, t time.Time) {
	if ns == nil {
		return
	}
	ns.Lock()
	defer ns.Unlock()

	if s, ok := ns.stopwatches[name]; ok {
		s.AddElapsedSince(t)
	}
}
601981
func (l *TimeLimiter) add(now time.Time, d time.Duration) {
	if now.After(l.next) {
		l.timeSpent = d
		l.since = now.Add(-d)
		l.next = l.since.Add(l.window)
		return
	}
	l.timeSpent += d
}
1291428
func (s *DescribeDeviceOutput) SetFirstAccessedTime(v time.Time) *DescribeDeviceOutput {
	s.FirstAccessedTime = &v
	return s
}
392837
func (mt *MultiTimings) Add(names []string, elapsed time.Duration) {
	if len(names) != len(mt.labels) {
		panic("MultiTimings: wrong number of values in Add")
	}
	mt.Timings.Add(safeJoinLabels(names), elapsed)
}
535758
func (s *CreateHITInput) SetLifetimeInSeconds(v int64) *CreateHITInput {
	s.LifetimeInSeconds = &v
	return s
}
491222
func (s *RestoreStatus) SetEstimatedTimeToCompletionInSeconds(v int64) *RestoreStatus {
	s.EstimatedTimeToCompletionInSeconds = &v
	return s
}
864777
func (s *Store) MeasureSince(key string, start time.Time) {
	s.mu.Lock()
	s.metrics[key] = append(s.metrics[key], time.Since(start))
	s.mu.Unlock()
}
104597
func (t *Timedelta) Add(t2 *Timedelta) Timedelta {
	return Timedelta{
		Days:         t.Days + t2.Days,
		Seconds:      t.Seconds + t2.Seconds,
		Microseconds: t.Microseconds + t2.Microseconds,
		Milliseconds: t.Milliseconds + t2.Milliseconds,
		Minutes:      t.Minutes + t2.Minutes,
		Hours:        t.Hours + t2.Hours,
		Weeks:        t.Weeks + t2.Weeks,
	}
}
1168770
func (t *TimeCounter) Add(dur time.Duration) {
	if dur.Nanoseconds() <= atomic.LoadInt64(&t.NsBarrier) {
		atomic.AddInt64(&t.Below, 1)
		return
	}
	atomic.AddInt64(&t.Above, 1)
}
188182
func (s *CancelResizeOutput) SetElapsedTimeInSeconds(v int64) *CancelResizeOutput {
	s.ElapsedTimeInSeconds = &v
	return s
}
778624
func (sb *storageBackend) addVolumeOps(params VolumeParams, hostId string) ([]txn.Op, names.VolumeTag, error) {
	params, err := sb.volumeParamsWithDefaults(params)
	if err != nil {
		return nil, names.VolumeTag{}, errors.Trace(err)
	}
	detachable, err := isDetachableVolumePool(sb, params.Pool)
	if err != nil {
		return nil, names.VolumeTag{}, errors.Trace(err)
	}
	origHostId := hostId
	hostId, err = sb.validateVolumeParams(params, hostId)
	if err != nil {
		return nil, names.VolumeTag{}, errors.Annotate(err, "validating volume params")
	}
	name, err := newVolumeName(sb.mb, hostId)
	if err != nil {
		return nil, names.VolumeTag{}, errors.Annotate(err, "cannot generate volume name")
	}
	statusDoc := statusDoc{
		Status:  status.Pending,
		Updated: sb.mb.clock().Now().UnixNano(),
	}
	doc := volumeDoc{
		Name:      name,
		StorageId: params.storage.Id(),
	}
	if params.volumeInfo != nil {
		// We're importing an already provisioned volume into the
		// model. Set provisioned info rather than params, and set
		// the status to "detached".
		statusDoc.Status = status.Detached
		doc.Info = params.volumeInfo
	} else {
		// Every new volume is created with one attachment.
		doc.Params = &params
		doc.AttachmentCount = 1
	}
	if !detachable {
		doc.HostId = origHostId
	}
	return sb.newVolumeOps(doc, statusDoc), names.NewVolumeTag(name), nil
}
154916
func UntilElapsed(maxElapsed, sleepBetweenRetries time.Duration) Policy {
	return untilElapsed{
		maxElapsed:          maxElapsed,
		sleepBetweenRetries: sleepBetweenRetries,
	}
}
1006243
func (s *Stopwatch) elapsed() time.Duration {
	if s.isRunning() {
		return time.Since(s.refTime)
	}
	return s.elapsedTime
}
548910
func (a *Automaton) addEpsilon(source, dest int) {
	t := newTransition()
	count := a.initTransition(dest, t)
	for i := 0; i < count; i++ {
		a.nextTransition(t)
		a.addTransitionRange(source, t.dest, t.min, t.max)
	}
	if a.IsAccept(dest) {
		a.setAccept(source, true)
	}
}
1138669
func (t *Timings) Add(name string, elapsed time.Duration) {
	t.mu.Lock()
	defer t.mu.Unlock()

	hist, ok := t.histograms[name]
	if !ok {
		hist = NewGenericHistogram("", bucketCutoffs, bucketLabels, "Count", "Time")
		t.histograms[name] = hist
	}
	elapsedNs := int64(elapsed)
	hist.Add(elapsedNs)
	t.totalCount++
	t.totalTime += elapsedNs
}
589333
func (v *Duration) Add(delta time.Duration) {
	v.i.Add(delta)
}
432494
func (fr *FacetRequest) AddDateTimeRange(name string, start, end time.Time) {
	if fr.DateTimeRanges == nil {
		fr.DateTimeRanges = make([]*dateTimeRange, 0, 1)
	}
	fr.DateTimeRanges = append(fr.DateTimeRanges, &dateTimeRange{Name: name, Start: start, End: end})
}