diff --git a/types/time.go b/types/time.go index 950bb43cb3d7a..733b4fc732664 100644 --- a/types/time.go +++ b/types/time.go @@ -421,9 +421,11 @@ func RoundFrac(t gotime.Time, fsp int) (gotime.Time, error) { } // TruncateFrac truncates fractional seconds precision with new fsp and returns a new one. +// 2011:11:11 10:10:10.888888 round 0 -> 2011:11:11 10:10:10 +// 2011:11:11 10:10:10.111111 round 0 -> 2011:11:11 10:10:10 func TruncateFrac(t gotime.Time, fsp int) (gotime.Time, error) { if _, err := CheckFsp(fsp); err != nil { - return t, errors.Trace(err) + return t, err } return t.Truncate(gotime.Duration(math.Pow10(9-fsp)) * gotime.Nanosecond), nil }