Skip to content

Commit

Permalink
address comment
Browse files Browse the repository at this point in the history
  • Loading branch information
zhexuany committed Sep 14, 2018
1 parent 44996c2 commit bd1693e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
3 changes: 2 additions & 1 deletion session/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -1072,13 +1072,14 @@ func CreateSession(store kv.Storage) (Session, error) {
func loadSystemTZ(se *session) (string, error) {
sql := `select variable_value from mysql.tidb where variable_name = "system_tz"`
rss, errLoad := se.Execute(context.Background(), sql)
defer rss.Close()
if errLoad != nil {
return "", errLoad
}
chk := rss[0].NewChunk()
defer chk.Close()
rss[0].Next(context.Background(), chk)
return chk.GetRow(0).GetString(0), nil

}

// BootstrapSession runs the first time when the TiDB server start.
Expand Down
6 changes: 2 additions & 4 deletions util/timeutil/time.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2017 PingCAP, Inc.
// Copyright 2018 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -39,7 +39,7 @@ func init() {
// locCa is a simple cache policy to improve the performance of 'time.LoadLocation'.
var locCa *locCache

// LocalStr is current TiDB's system timezone name.
// systemTZ is current TiDB's system timezone name.
var systemTZ string
var zoneSources = []string{
"/usr/share/zoneinfo/",
Expand Down Expand Up @@ -145,8 +145,6 @@ func LoadLocation(name string) (*time.Location, error) {

// Zone returns the current timezone name and timezone offset in seconds.
// In compatible with MySQL, we change `Local` to `System`.
// TODO: Golang team plan to return system timezone name intead of
// returning `Local` when `loc` is `time.Local`. We need keep an eye on this.
func Zone(loc *time.Location) (string, int64) {
_, offset := time.Now().In(loc).Zone()
var name string
Expand Down
2 changes: 1 addition & 1 deletion util/timeutil/time_test.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2018 The ql Authors. All rights reserved.
// Copyright 2018 PingCAP, Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSES/QL-LICENSE file.

Expand Down

0 comments on commit bd1693e

Please sign in to comment.