-
Notifications
You must be signed in to change notification settings - Fork 5.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
type: fix parseDuration error when parse string of three digit #3468
Conversation
mysql> select addtime("234", "1.123"); |
PTAL @tiancaiamao |
@@ -908,6 +908,9 @@ func ParseDuration(str string, fsp int) (Duration, error) { | |||
} else if len(str) == 4 { | |||
// MMSS | |||
_, err = fmt.Sscanf(str, "%2d%2d", &minute, &second) | |||
} else if len(str) == 3 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add an unit test in time_test.go for ParseDuration.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
@tiancaiamao @XuHuaiyu PTAL |
LGTM |
PTAL @tiancaiamao |
LGTM |
I fix a bug. when parseDuration("123"), it will give a error “invalid time format” , it should return "00:01:23".