Merge pull request #350 from localvar/issue-349

Issue 349
This commit is contained in:
slguan 2019-08-17 15:03:19 +08:00 committed by GitHub
commit 392bbb82f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 11 deletions

View File

@ -142,21 +142,15 @@ int32_t parseTimezone(char* str, int64_t* tzOffset) {
i += 2;
}
if (hour > 12) {
int64_t minute = strnatoi(&str[i], 2);
if (minute > 59) {
return -1;
}
int64_t sec = strnatoi(&str[i], 2);
if (sec > 70) {
return -1;
}
sec += (hour * 3600);
if (str[0] == '+') {
*tzOffset = -sec;
*tzOffset = -(hour * 3600 + minute * 60);
} else {
*tzOffset = sec;
*tzOffset = hour * 3600 + minute * 60;
}
return 0;

View File

@ -227,7 +227,7 @@ int64_t strnatoi(char *num, int32_t len) {
} else {
return 0;
}
ret = dig * base;
ret += dig * base;
}
} else {
for (i = len - 1; i >= 0; --i, base *= 10) {