| 21 | namespace arrow::matlab::type { |
| 22 | |
| 23 | arrow::Result<arrow::TimeUnit::type> timeUnitFromString(std::u16string_view unit_str) { |
| 24 | if (unit_str == u"Second") { |
| 25 | return arrow::TimeUnit::type::SECOND; |
| 26 | } else if (unit_str == u"Millisecond") { |
| 27 | return arrow::TimeUnit::type::MILLI; |
| 28 | } else if (unit_str == u"Microsecond") { |
| 29 | return arrow::TimeUnit::type::MICRO; |
| 30 | } else if (unit_str == u"Nanosecond") { |
| 31 | return arrow::TimeUnit::type::NANO; |
| 32 | } else { |
| 33 | auto maybe_utf8 = arrow::util::UTF16StringToUTF8(unit_str); |
| 34 | auto msg = maybe_utf8.ok() ? "Unknown time unit string: " + *maybe_utf8 |
| 35 | : "Unknown time unit string"; |
| 36 | return arrow::Status::Invalid(msg); |
| 37 | } |
| 38 | } |
| 39 | |
| 40 | template <> |
| 41 | arrow::Status validateTimeUnit<arrow::Time32Type>(arrow::TimeUnit::type unit) { |
nothing calls this directly
no test coverage detected