| 478 | |
| 479 | template <typename Duration> |
| 480 | static inline bool ParseHH_MM(const char* s, Duration* out) { |
| 481 | uint8_t hours = 0; |
| 482 | uint8_t minutes = 0; |
| 483 | if (ARROW_PREDICT_FALSE(s[2] != ':')) { |
| 484 | return false; |
| 485 | } |
| 486 | if (ARROW_PREDICT_FALSE(!ParseUnsigned(s + 0, 2, &hours))) { |
| 487 | return false; |
| 488 | } |
| 489 | if (ARROW_PREDICT_FALSE(!ParseUnsigned(s + 3, 2, &minutes))) { |
| 490 | return false; |
| 491 | } |
| 492 | if (ARROW_PREDICT_FALSE(hours >= 24)) { |
| 493 | return false; |
| 494 | } |
| 495 | if (ARROW_PREDICT_FALSE(minutes >= 60)) { |
| 496 | return false; |
| 497 | } |
| 498 | *out = std::chrono::duration_cast<Duration>(std::chrono::hours(hours) + |
| 499 | std::chrono::minutes(minutes)); |
| 500 | return true; |
| 501 | } |
| 502 | |
| 503 | template <typename Duration> |
| 504 | static inline bool ParseHHMM(const char* s, Duration* out) { |
no test coverage detected