Skip to content

Commit

Permalink
types: Fix potential timezone related bugs caused by gotime.Local
Browse files Browse the repository at this point in the history
  • Loading branch information
Rustin170506 committed Nov 26, 2019
1 parent bc21efe commit 15197bd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion types/time.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 15197bd

Please sign in to comment.