From 15197bd7433161a8dd5634f8748b5520b38c26d4 Mon Sep 17 00:00:00 2001 From: Rustin-liu Date: Tue, 26 Nov 2019 19:19:20 +0800 Subject: [PATCH] types: Fix potential timezone related bugs caused by `gotime.Local` --- types/time.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/time.go b/types/time.go index 3127aa32bb696..3001744ae76a4 100644 --- a/types/time.go +++ b/types/time.go @@ -430,7 +430,7 @@ func (t Time) RoundFrac(sc *stmtctx.StatementContext, fsp int8) (Time, error) { } else { // Take the hh:mm:ss part out to avoid handle month or day = 0. hour, minute, second, microsecond := t.Time.Hour(), t.Time.Minute(), t.Time.Second(), t.Time.Microsecond() - t1 := gotime.Date(1, 1, 1, hour, minute, second, microsecond*1000, gotime.Local) + t1 := gotime.Date(1, 1, 1, hour, minute, second, microsecond*1000, sc.TimeZone) t2 := roundTime(t1, fsp) hour, minute, second = t2.Clock() microsecond = t2.Nanosecond() / 1000