// Since returns time since the time in f.
498085
func (f *FakeClock) Since(ts time.Time) time.Duration {
	f.lock.RLock()
	defer f.lock.RUnlock()
	return f.time.Sub(ts)
}
307959
func (r *Response) After(fn func()) {
	r.afterFuncs = append(r.afterFuncs, fn)
}
1202071
func (it *lfuItem) IsExpired(now *time.Time) bool {
	if it.expiration == nil {
		return false
	}
	if now == nil {
		t := it.clock.Now()
		now = &t
	}
	return it.expiration.Before(*now)
}
1159839
func (l *TimeLimiter) wait(now time.Time) time.Duration {

	// if we passed the window, reset and start over
	// if clock is adjusted backwards, best we can do is also just reset and start over
	if now.After(l.next) || now.Before(l.since) {
		l.timeSpent = 0
		l.since = now
		l.next = now.Add(l.window)
		return 0
	}
	if l.timeSpent < l.limit {
		return 0
	}

	// here we know that:
	// since <= now <= next
	// timespent >= limit
	timeToPass := time.Duration(float64(l.timeSpent) * l.factor)
	timePassed := now.Sub(l.since)

	// not sure if this should happen, but let's be safe anyway
	if timePassed > timeToPass {
		return 0
	}
	return timeToPass - timePassed
}
1292991
func (f *FakeClock) Now() time.Time {
	f.lock.RLock()
	defer f.lock.RUnlock()
	return f.time
}
463610
func (t UnixTime) Before(t2 UnixTime) bool {
	return time.Time(t).Before(time.Time(t2))
}
1167059
func (f Filter) Like(val interface{}) Filter {
	f.Op = "~"
	f.Val = val
	return f
}
1102056
func (s *Simulated) After(d time.Duration) <-chan time.Time {
	after := make(chan time.Time, 1)
	s.insert(d, func() {
		after <- (time.Time{}).Add(time.Duration(s.now))
	})
	return after
}
116992
func (dtp *DefaultTimestampProvider) Now() Timestamp {
	return Timestamp{
		Time: uint64(time.Now().Unix()),
	}
}
119723
func (m *Schema) Since(dur time.Duration) bool {
	if m.lastRefreshed.IsZero() {
		return false
	}
	if m.lastRefreshed.After(time.Now().Add(dur)) {
		return true
	}
	return false
}
1067022
func (fc *fakeClock) Now() time.Time {
	fc.l.RLock()
	t := fc.time
	fc.l.RUnlock()
	return t
}
400916
func (dc DefaultClock) AfterFunc(d time.Duration, f func()) Timer {
	return &defaultTimer{*time.AfterFunc(d, f)}
}
583096
func DateDefNow(year, month, day, hour, minute, sec, nsec int) time.Time {
	now := Now()
	nyear, nmonth, nday := now.Date()
	nhour, nminute, nsec := now.Clock()
	if year < 0 {
		year = nyear
	}
	if month < 0 {
		month = int(nmonth)
	}
	if day < 0 {
		day = nday
	}
	if hour < 0 {
		hour = nhour
	}
	if minute < 0 {
		minute = nminute
	}
	if sec < 0 {
		sec = nsec
	}

	return time.Date(year, time.Month(month), day, hour, minute, sec, nsec, Location)
}
488666
func (r *Linear) After() <-chan time.Time {
	if r.Duration() == 0 {
		return r.closedChan
	}
	return time.After(r.Duration())
}
1180523
func (c Context) Timestamp() Context {
	c.l = c.l.Hook(th)
	return c
}
473912
func (list *List) Filter(f func(string) bool) {
	if list.length == 0 {
		return
	}
	var start, current *ListItem
	length := 0
	tmp := list.first
	for i := 0; i < list.length; i++ {
		if f(tmp.Content) {
			if length == 0 {
				start = tmp
				current = tmp
			} else {
				current.Next = tmp
				current = tmp
			}
			length++
		}
		if tmp.Next != nil {
			tmp = tmp.Next
		} else {
			break
		}
	}
	list.first = start
	list.last = current
	list.length = length
}
137584
func (s *allInstancesSnapshot) olderThan(other *allInstancesSnapshot) bool {
	// After() is technically broken by time changes until we have monotonic time
	return other.timestamp.After(s.timestamp)
}