Skip to content

Commit

Permalink
update comments
Browse files Browse the repository at this point in the history
  • Loading branch information
qw4990 committed Mar 28, 2019
1 parent 4149a28 commit b1332d7
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion types/time.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit b1332d7

Please sign in to comment.