| 183 | } |
| 184 | |
| 185 | bool ParseFractionToken(const char* token, int token_len, |
| 186 | DateTimeParseResult* result) { |
| 187 | DCHECK(token != nullptr); |
| 188 | DCHECK(token_len > 0); |
| 189 | DCHECK(result != nullptr); |
| 190 | StringParser::ParseResult status; |
| 191 | result->fraction = |
| 192 | StringParser::StringToInt<int32_t>(token, token_len, &status); |
| 193 | if (UNLIKELY(StringParser::PARSE_SUCCESS != status)) return false; |
| 194 | // A user may specify a time of 04:30:22.1238, the parser will return 1238 for |
| 195 | // the fractional portion. This does not represent the intended value of |
| 196 | // 123800000, therefore the number must be scaled up. |
| 197 | if (token_len < FRACTIONAL_SECOND_MAX_LENGTH) { |
| 198 | result->fraction *= std::pow(10, FRACTIONAL_SECOND_MAX_LENGTH - token_len); |
| 199 | } |
| 200 | return true; |
| 201 | } |
| 202 | |
| 203 | int GetQuarter(int month) { |
| 204 | DCHECK(month > 0 && month <= 12); |
no outgoing calls
no test coverage detected