MCPcopy Create free account
hub / github.com/apache/arrow / ParseHH_MM

Function ParseHH_MM

cpp/src/arrow/util/value_parsing.h:480–501  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

478
479template <typename Duration>
480static 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
503template <typename Duration>
504static inline bool ParseHHMM(const char* s, Duration* out) {

Callers 3

ParseTimestampISO8601Function · 0.85
ConvertMethod · 0.85
LocateZoneFunction · 0.85

Calls 1

ParseUnsignedFunction · 0.85

Tested by

no test coverage detected