| 633 | } |
| 634 | |
| 635 | Result<int> get_difftime_unit_multiplier(SEXP x) { |
| 636 | std::string unit(CHAR(STRING_ELT(Rf_getAttrib(x, symbols::units), 0))); |
| 637 | if (unit == "secs") { |
| 638 | return 1; |
| 639 | } else if (unit == "mins") { |
| 640 | return 60; |
| 641 | } else if (unit == "hours") { |
| 642 | return 3600; |
| 643 | } else if (unit == "days") { |
| 644 | return 86400; |
| 645 | } else if (unit == "weeks") { |
| 646 | return 604800; |
| 647 | } else { |
| 648 | return Status::Invalid("unknown difftime unit"); |
| 649 | } |
| 650 | } |
| 651 | |
| 652 | template <typename T> |
| 653 | class RPrimitiveConverter<T, enable_if_t<is_time_type<T>::value>> |