'2009-04-19T12:30:45-00:90:00', # Time zone field out from range
'2009-04-19T12:30:45-00:00:90', # Time zone field out from range
'2020-2020', # Ambiguous 9-char date portion
+ '2009-04-19T12:30:45.+05:00', # Empty fraction before offset
+ '2009-04-19T12:30:45.-05:00', # Empty fraction before offset
+ '2009-04-19T12:30:45.Z', # Empty fraction before Z
+ '2009-04-19T12:30:45,+05:00', # Empty fraction (comma) before offset
]
for bad_str in bad_strs:
'24:01:00.000000', # Has non-zero minutes on 24:00
'12:30:45+00:90:00', # Time zone field out from range
'12:30:45+00:00:90', # Time zone field out from range
+ '12:30:45.+05:00', # Empty fraction before offset
+ '12:30:45.-05:00', # Empty fraction before offset
+ '12:30:45.Z', # Empty fraction before Z
+ '12:30:45,+05:00', # Empty fraction (comma) before offset
]
for bad_str in bad_strs:
has_separator = (c == ':');
}
- if (p >= p_end) {
+ if (c == '.' || c == ',') {
+ if (i < 2) {
+ return -3; // Decimal mark on hour or minute
+ }
+ if (p >= p_end) {
+ return -3; // Decimal mark not followed by any digit
+ }
+ break;
+ }
+ else if (p >= p_end) {
return c != '\0';
}
else if (has_separator && (c == ':')) {
}
continue;
}
- else if (c == '.' || c == ',') {
- if (i < 2) {
- return -3; // Decimal mark on hour or minute
- }
- break;
- } else if (!has_separator) {
+ else if (!has_separator) {
--p;
- } else {
+ }
+ else {
return -4; // Malformed time separator
}
}