//GetTime returns the value of a Cell as a time.Time
332122
func (c *Cell) GetTime(date1904 bool) (t time.Time, err error) {
	f, err := c.Float()
	if err != nil {
		return t, err
	}
	return TimeFromExcelTime(f, date1904), nil
}
1050305
func (ms *MemStore) GetWithTime(key string) (int64, time.Time, error) {
	now := time.Now()
	valP, ok := ms.get(key, false)

	if !ok {
		return -1, now, nil
	}

	return atomic.LoadInt64(valP), now, nil
}
1301609
func GetTimeValue(ctx sessionctx.Context, v interface{}, tp byte, fsp int) (d types.Datum, err error) {
	value := types.Time{
		Type: tp,
		Fsp:  fsp,
	}

	sc := ctx.GetSessionVars().StmtCtx
	switch x := v.(type) {
	case string:
		upperX := strings.ToUpper(x)
		if upperX == strings.ToUpper(ast.CurrentTimestamp) {
			defaultTime, err := getSystemTimestamp(ctx)
			if err != nil {
				return d, err
			}
			value.Time = types.FromGoTime(defaultTime.Truncate(time.Duration(math.Pow10(9-fsp)) * time.Nanosecond))
			if tp == mysql.TypeTimestamp || tp == mysql.TypeDatetime {
				err = value.ConvertTimeZone(time.Local, ctx.GetSessionVars().Location())
				if err != nil {
					return d, err
				}
			}
		} else if upperX == types.ZeroDatetimeStr {
			value, err = types.ParseTimeFromNum(sc, 0, tp, fsp)
			terror.Log(err)
		} else {
			value, err = types.ParseTime(sc, x, tp, fsp)
			if err != nil {
				return d, err
			}
		}
	case *driver.ValueExpr:
		switch x.Kind() {
		case types.KindString:
			value, err = types.ParseTime(sc, x.GetString(), tp, fsp)
			if err != nil {
				return d, err
			}
		case types.KindInt64:
			value, err = types.ParseTimeFromNum(sc, x.GetInt64(), tp, fsp)
			if err != nil {
				return d, err
			}
		case types.KindNull:
			return d, nil
		default:
			return d, errDefaultValue
		}
	case *ast.FuncCallExpr:
		if x.FnName.L == ast.CurrentTimestamp {
			d.SetString(strings.ToUpper(ast.CurrentTimestamp))
			return d, nil
		}
		return d, errDefaultValue
	case *ast.UnaryOperationExpr:
		// support some expression, like `-1`
		v, err := EvalAstExpr(ctx, x)
		if err != nil {
			return d, err
		}
		ft := types.NewFieldType(mysql.TypeLonglong)
		xval, err := v.ConvertTo(ctx.GetSessionVars().StmtCtx, ft)
		if err != nil {
			return d, err
		}

		value, err = types.ParseTimeFromNum(sc, xval.GetInt64(), tp, fsp)
		if err != nil {
			return d, err
		}
	default:
		return d, nil
	}
	d.SetMysqlTime(value)
	return d, nil
}
55199
func (asyncResult *AsyncResult) Get(sleepDuration time.Duration) ([]reflect.Value, error) {
	for {
		results, err := asyncResult.Touch()

		if results == nil && err == nil {
			time.Sleep(sleepDuration)
		} else {
			return results, err
		}
	}
}
558042
func (d *Domain) GetTime(flags uint32) (int64, uint, error) {
	if C.LIBVIR_VERSION_NUMBER < 1002005 {
		return 0, 0, makeNotImplementedError("virDomainGetTime")
	}
	var secs C.longlong
	var nsecs C.uint
	var err C.virError
	ret := C.virDomainGetTimeWrapper(d.ptr, &secs, &nsecs, C.uint(flags), &err)
	if ret == -1 {
		return 0, 0, makeError(&err)
	}

	return int64(secs), uint(nsecs), nil
}
567239
func (t Result) Time() time.Time {
	res, _ := time.Parse(time.RFC3339, t.String())
	return res
}
339179
func (o *pdOracle) GetTimestamp(ctx context.Context) (uint64, error) {
	ts, err := o.getTimestamp(ctx)
	if err != nil {
		return 0, errors.Trace(err)
	}
	o.setLastTS(ts)
	return ts, nil
}
972649
func (t *StandardResettingTimer) Time(f func()) {
	ts := time.Now()
	f()
	t.Update(time.Since(ts))
}
686245
func (m *Message) Time() time.Time {
	return time.Unix(int64(m.Date), 0)
}
1106492
func (c *Ctx) GetTimeout() time.Duration {
	return time.Duration(C.X_SSL_CTX_get_timeout(c.ctx)) * time.Second
}
59861
func (o *ValidUntilOption) Get() time.Time {
	if o == nil {
		return time.Time{}
	}
	return o.value
}
717750
func (c *Animation) GetCurrentTime(id string) (float64, error) {
	var v AnimationGetCurrentTimeParams
	v.Id = id
	return c.GetCurrentTimeWithParams(&v)
}
398621
func (p *Process) GetUptime() time.Duration {
	if p.startTime.Nanosecond() == 0 {
		return 0
	}
	return time.Since(p.startTime)
}
572890
func (n *NullTime) Get() *time.Time {
	if !n.Valid {
		return nil
	}

	return &n.Time
}
852943
func (r *RedigoStore) GetWithTime(key string) (int64, time.Time, error) {
	var now time.Time

	key = r.prefix + key

	conn, err := r.getConn()
	if err != nil {
		return 0, now, err
	}
	defer conn.Close()

	conn.Send("TIME")
	conn.Send("GET", key)
	conn.Flush()
	timeReply, err := redis.Values(conn.Receive())
	if err != nil {
		return 0, now, err
	}

	var s, us int64
	if _, err := redis.Scan(timeReply, &s, &us); err != nil {
		return 0, now, err
	}
	now = time.Unix(s, us*int64(time.Microsecond))

	v, err := redis.Int64(conn.Receive())
	if err == redis.ErrNil {
		return -1, now, nil
	} else if err != nil {
		return 0, now, err
	}

	return v, now, nil
}
1351046
func (c *config) GetTime(key string, args ...interface{}) time.Time {
	val, err := c.GetTimeErr(key, args...)
	if err != nil {
		c.errorHandler(key, err, args...)
	}
	return val
}
761064
func ToTime(i interface{}) time.Time {
	if i == nil {
		return time.Time{}
	}

	if t, ok := i.(int64); ok {
		return time.Unix(t, 0).UTC()
	} else if t, ok := i.(float64); ok {
		return time.Unix(int64(t), 0).UTC()
	} else if t, ok := i.(time.Time); ok {
		return t
	}

	return time.Time{}
}