// ClockAt returns a new clock identified by name and tags with a specified
// start time.
337005
func (eng *Engine) ClockAt(name string, start time.Time, tags ...Tag) *Clock {
	cpy := make([]Tag, len(tags), len(tags)+1) // clock always appends a stamp.
	copy(cpy, tags)
	return &Clock{
		name:  name,
		first: start,
		last:  start,
		tags:  cpy,
		eng:   eng,
	}
}
890084
func (s *BatchPrediction) SetStartedAt(v time.Time) *BatchPrediction {
	s.StartedAt = &v
	return s
}
995380
func (b *BaseBody) SetCreatedAt(t *strfmt.DateTime) {
	if t == nil {
		b.StructCreatedAt = time.Now().UTC()
	} else {
		b.StructCreatedAt = time.Time(*t)
	}
}
441582
func (t *Timetag) SetTime(time time.Time) {
	t.time = time
	t.timeTag = timeToTimetag(time)
}
1334406
func (s *Evaluation) SetStartedAt(v time.Time) *Evaluation {
	s.StartedAt = &v
	return s
}
1097333
func (c *Client) Timing(name string, value time.Duration, tags []string, rate float64) error {
	return c.TimeInMilliseconds(name, value.Seconds()*1000, tags, rate)
}
985828
func (s *StatusEvent) GetCreatedAt() Timestamp {
	if s == nil || s.CreatedAt == nil {
		return Timestamp{}
	}
	return *s.CreatedAt
}
425638
func (p *Init) ExitedAt() time.Time {
	p.mu.Lock()
	defer p.mu.Unlock()

	return p.exited
}
332207
func (s *JobExecution) SetStartedAt(v time.Time) *JobExecution {
	s.StartedAt = &v
	return s
}
1190352
func (s *Task) SetStartedAt(v time.Time) *Task {
	s.StartedAt = &v
	return s
}
253601
func (s *CreateHITOutput) SetHIT(v *HIT) *CreateHITOutput {
	s.HIT = v
	return s
}
174279
func (r *RepositoryRelease) GetCreatedAt() Timestamp {
	if r == nil || r.CreatedAt == nil {
		return Timestamp{}
	}
	return *r.CreatedAt
}
444405
func updatedAt(wi workitem.WorkItem) time.Time {
	var t time.Time
	if ua, ok := wi.Fields[workitem.SystemUpdatedAt]; ok {
		t = ua.(time.Time)
	}
	return t.Truncate(time.Second)
}
108206
func (s *Task) SetStoppedAt(v time.Time) *Task {
	s.StoppedAt = &v
	return s
}
35904
func (s *States) setStateAt(state int64, now time.Time) {
	if state < 0 || state >= int64(len(s.labels)) {
		panic(fmt.Errorf("State out of range 0-%v: %v", len(s.labels), state))
	}

	s.mu.Lock()
	defer s.mu.Unlock()

	// check we're going strictly forward in time
	dur := now.Sub(s.since)
	if dur < 0 {
		panic(fmt.Errorf("Time going backwards? %v < %v", now, s.since))
	}

	// record the previous state duration, reset our state
	s.durations[s.state] += dur
	s.transitions[state] += 1
	s.state = state
	s.since = now
}
1320265
func (s *Segment) ReadAt(p []byte, off int64) (n int, err error) {
	s.Lock()
	defer s.Unlock()
	return s.log.ReadAt(p, off)
}
206732
func (ts *TimeFlag) Set(value string) error {
	t, err := ParseTime(value)
	*ts = TimeFlag(t)
	return err
}