// Farthest returns the farthest date from the current time
358584
func (c *Carbon) Farthest(a, b *Carbon) *Carbon {
	if c.DiffInSeconds(a, true) > c.DiffInSeconds(b, true) {
		return a
	}

	return b
}
1102105
func InclusiveDate(year int, month time.Month, day int) time.Time {
	return time.Date(year, month, day, 0, 0, 0, 0, time.UTC).Add(-1 * time.Nanosecond)
}
1000985
func closestMonday(date time.Time) time.Time {
	wd := date.Weekday()
	if wd == 0 {
		date = date.AddDate(0, 0, 1)
	}

	if wd == 6 {
		date = date.AddDate(0, 0, 2)
	}

	return date
}
596372
func (f *FreqDist) max() (string, error) {
	if len(f.Samples) == 0 {
		return "", fmt.Errorf("No Samples loaded, please add samples before getting max")
	}

	max := maxFreq{}
	for key, val := range f.Samples {
		if val > max.Val {
			max.Key = key
			max.Val = val
		}
	}
	return max.Key, nil
}
86968
func (t *TimeTable) NearestIndex(when time.Time) uint64 {
	t.l.RLock()
	defer t.l.RUnlock()

	n := len(t.table)
	idx := sort.Search(n, func(i int) bool {
		return !t.table[i].Time.After(when)
	})
	if idx < n && idx >= 0 {
		return t.table[idx].Index
	}
	return 0
}
153950
func (s *Benchmark) Slowest() time.Duration {
	s.RLock()
	defer s.RUnlock()
	return s.castSeconds(s.Statistics.Maximum())
}
22170
func Maximum() (int, error) {
	var limit syscall.Rlimit
	if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &limit); err != nil {
		return 0, err
	}
	return int(limit.Max), nil
}
1214452
func (tr Row) ForceLocaltime(nn int) (val time.Time) {
	val, _ = tr.LocaltimeErr(nn)
	return
}
8908
func (mvl *MetricsList) Last() *MetricValue {
	if len(mvl.data) > 0 {
		mvl.Sort()
		return mvl.data[len(mvl.data)-1]
	}
	return nil
}
100940
func (q *TermRangeQuery) Max(max string, inclusive bool) *TermRangeQuery {
	q.options["max"] = max
	q.options["inclusive_max"] = inclusive
	return q
}
293012
func (m *MarketplacePurchaseEvent) GetEffectiveDate() Timestamp {
	if m == nil || m.EffectiveDate == nil {
		return Timestamp{}
	}
	return *m.EffectiveDate
}
949719
func (c *Carbon) PreviousWeekendDay() *Carbon {
	c = c.SubDay()
	for !c.IsWeekend() {
		c = c.SubDay()
	}

	return c
}
1320178
func (w *ConditionalWrite) Last() string {
	if len(w.Queued) == 0 {
		return ""
	}
	return w.Queued[len(w.Queued)-1]
}
763914
func Date(ti int64, format string) string {
	t := time.Unix(int64(ti), 0)
	return DateT(t, format)
}
941157
func (l *Limiter) GetMax() float64 {
	l.RLock()
	defer l.RUnlock()
	return l.max
}
611265
func (c *Conn) LastRdyTime() time.Time {
	return time.Unix(0, atomic.LoadInt64(&c.lastRdyTimestamp))
}
701111
func (c *Carbon) NextWeekendDay() *Carbon {
	c = c.AddDay()
	for !c.IsWeekend() {
		c = c.AddDay()
	}

	return c
}