// NowTime2 return current time
359179
func (engine *Engine) NowTime2(sqlTypeName string) (interface{}, time.Time) {
	t := time.Now()
	return engine.FormatTime(sqlTypeName, t), t
}
1067022
func (fc *fakeClock) Now() time.Time {
	fc.l.RLock()
	t := fc.time
	fc.l.RUnlock()
	return t
}
1282868
func CheckCurrentTimeZone(db *sql.DB) (currentTZ string, err error) {
	if err = db.QueryRow(`SHOW TIME ZONE`).Scan(&currentTZ); err != nil {
		err = fmt.Errorf("unable to query current time zone: %v", err)
	}
	return
}
1060871
func (sc *SimulatedClock) SetTime(t time.Time) {
	sc.mu.Lock()
	defer sc.mu.Unlock()

	sc.t = t
}
281802
func TimeToTimestamp(t time.Time) *timestamp.Timestamp {
	return &timestamp.Timestamp{
		Seconds: t.UnixNano() / int64(time.Second),
		Nanos:   int32(t.UnixNano() % int64(time.Second)),
	}
}
702604
func (m *Miniredis) SetTime(t time.Time) {
	m.Lock()
	defer m.Unlock()
	m.now = t
}
177446
func (v *Validator) validTimestamp(ts string) bool {
	t, err := stringToTime(ts)
	if err != nil {
		return false
	}
	diff := time.Now().Add(ValidityWindow / 2).Sub(t)
	return diff < ValidityWindow && diff > 0
}
1110847
func TimeForDt14(dt14 int64) (time.Time, error) {
	return time.Parse(DT14, strconv.FormatInt(dt14, 10))
}
579182
func (t JSONTime) Time() time.Time {
	t0, err := time.Parse("20060102T150405-0700", string(t))
	if err != nil {
		return time.Time{}
	}
	return t0
}
974323
func deadlineTimer(t time.Time) *time.Timer {
	if t.IsZero() {
		return nil
	}
	return time.NewTimer(t.Sub(time.Now()))
}
1021191
func NowInLocation(loc string) (*Carbon, error) {
	l, err := time.LoadLocation(loc)
	if err != nil {
		return nil, err
	}
	return nowIn(l), nil
}
1311107
func MaxTime(t1, t2 time.Time) time.Time {
	if t1.After(t2) {
		return t1
	}
	return t2
}
218017
func (r *EwmaRate) Current(now time.Time) float64 {
	if r.lastTimestamp.IsZero() || r.lastTimestamp == now || now.Before(r.lastTimestamp) {
		return r.Ewma.Current
	}

	timeDelta := now.Sub(r.lastTimestamp)

	// Count as if nothing was received since last update and
	// don't save anything.
	return r.count(0, timeDelta)
}
748921
func (c *Cron) now() time.Time {
	return time.Now().In(c.location)
}
1316814
func TimeToNTP(t time.Time) uint64 {
	if t.IsZero() {
		return 0
	}
	return uint64(t.Unix()) + ntpDelta
}
338934
func ValueToTime(val Value) (time.Time, bool) {
	return ValueToTimeAnchor(val, time.Now())
}
664746
func Time(t time.Time) NullTime {
	return NullTime{
		pq.NullTime{
			Time:  t,
			Valid: true,
		},
	}
}