mirror of
https://github.com/ceph/ceph
synced 2024-12-17 17:05:42 +00:00
Merge pull request #5651 from theanalyst/rgw/fixiso8601
rgw: be more flexible with iso8601 timestamps
This commit is contained in:
commit
7515c04716
@ -357,18 +357,17 @@ bool parse_iso8601(const char *s, struct tm *t)
|
||||
}
|
||||
string str;
|
||||
trim_whitespace(p, str);
|
||||
if (str.size() == 1 && str[0] == 'Z')
|
||||
int len = str.size();
|
||||
|
||||
if (len == 1 && str[0] == 'Z')
|
||||
return true;
|
||||
|
||||
if (str.size() != 5) {
|
||||
return false;
|
||||
}
|
||||
if (str[0] != '.' ||
|
||||
str[str.size() - 1] != 'Z')
|
||||
str[len - 1] != 'Z')
|
||||
return false;
|
||||
|
||||
uint32_t ms;
|
||||
int r = stringtoul(str.substr(1, 3), &ms);
|
||||
int r = stringtoul(str.substr(1, len - 2), &ms);
|
||||
if (r < 0)
|
||||
return false;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user