Documentation ¶
Index ¶
- Variables
- func ConstructTimeZone(name string, offset int) (*time.Location, error)
- func GetSystemTZ() (string, error)
- func InferSystemTZ() string
- func LoadLocation(name string) (*time.Location, error)
- func ParseTimeZone(s string) (*time.Location, error)
- func SetSystemTZ(name string)
- func Sleep(ctx context.Context, d time.Duration) error
- func SystemLocation() *time.Location
- func WithinDayTimePeriod(start, end, now time.Time) bool
- func Zone(loc *time.Location) (string, int64)
Constants ¶
This section is empty.
Variables ¶
var ErrUnknownTimeZone = dbterror.ClassVariable.NewStd(mysql.ErrUnknownTimeZone)
ErrUnknownTimeZone indicates timezone is unknown.
Functions ¶
func ConstructTimeZone ¶
ConstructTimeZone constructs timezone by name first. When the timezone name is set, the daylight saving problem must be considered. Otherwise the timezone offset in seconds east of UTC is used to constructed the timezone.
func GetSystemTZ ¶
GetSystemTZ gets the value of systemTZ, an error is returned if systemTZ is not properly set.
func InferSystemTZ ¶
func InferSystemTZ() string
InferSystemTZ reads system timezone from `TZ`, the path of the soft link of `/etc/localtime`. If both of them are failed, system timezone will be set to `UTC`. It is exported because we need to use it during bootstrap stage. And it should be only used at that stage.
func LoadLocation ¶
LoadLocation loads time.Location by IANA timezone time.
func ParseTimeZone ¶
ParseTimeZone parses the time zone string, returns the location and whether the time zone is valid.
func SetSystemTZ ¶
func SetSystemTZ(name string)
SetSystemTZ sets systemTZ by the value loaded from mysql.tidb.
func Sleep ¶
Sleep is a function like time.Sleep(), the difference is it will return early when ctx finished.
func SystemLocation ¶
SystemLocation returns time.SystemLocation's IANA timezone location. It is TiDB's global timezone location.
func WithinDayTimePeriod ¶
WithinDayTimePeriod tests whether `now` is between `start` and `end`.
Types ¶
This section is empty.