| 502 | |
| 503 | template <typename Duration> |
| 504 | static inline bool ParseHHMM(const char* s, Duration* out) { |
| 505 | uint8_t hours = 0; |
| 506 | uint8_t minutes = 0; |
| 507 | if (ARROW_PREDICT_FALSE(!ParseUnsigned(s + 0, 2, &hours))) { |
| 508 | return false; |
| 509 | } |
| 510 | if (ARROW_PREDICT_FALSE(!ParseUnsigned(s + 2, 2, &minutes))) { |
| 511 | return false; |
| 512 | } |
| 513 | if (ARROW_PREDICT_FALSE(hours >= 24)) { |
| 514 | return false; |
| 515 | } |
| 516 | if (ARROW_PREDICT_FALSE(minutes >= 60)) { |
| 517 | return false; |
| 518 | } |
| 519 | *out = std::chrono::duration_cast<Duration>(std::chrono::hours(hours) + |
| 520 | std::chrono::minutes(minutes)); |
| 521 | return true; |
| 522 | } |
| 523 | |
| 524 | template <typename Duration> |
| 525 | static inline bool ParseHH_MM_SS(const char* s, Duration* out) { |
no test coverage detected