Skip to content
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

Merged
merged 10 commits into from
Jun 15, 2017

Conversation

hawkingrei
Copy link
Member

I fix a bug. when parseDuration("123"), it will give a error “invalid time format” , it should return "00:01:23".

@hawkingrei
Copy link
Member Author

hawkingrei commented Jun 13, 2017

mysql> select addtime("234", "1.123");
ERROR 1105 (HY000): invalid time format

@hawkingrei
Copy link
Member Author

@shenli @XuHuaiyu PTAL

@zimulala
Copy link
Contributor

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 {
Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@shenli
Copy link
Member

shenli commented Jun 14, 2017

@tiancaiamao @XuHuaiyu PTAL

@XuHuaiyu
Copy link
Contributor

LGTM

@XuHuaiyu
Copy link
Contributor

PTAL @tiancaiamao

@tiancaiamao
Copy link
Contributor

LGTM

@tiancaiamao tiancaiamao merged commit bdaf1e9 into pingcap:master Jun 15, 2017
@sre-bot sre-bot added the contribution This PR is from a community contributor. label Dec 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution This PR is from a community contributor.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants