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

Function ParseHHMM

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

Source from the content-addressed store, hash-verified

502
503template <typename Duration>
504static 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
524template <typename Duration>
525static inline bool ParseHH_MM_SS(const char* s, Duration* out) {

Callers 2

ParseTimestampISO8601Function · 0.85
LocateZoneFunction · 0.85

Calls 1

ParseUnsignedFunction · 0.85

Tested by

no test coverage detected