In the process of migrating from the classic API I have<br>found what appears to be a problem with Rcpp::Datetime.<br>There is no unit test for this situation.<br><br>Rcpp::Datetime dt("2015-04-15 06:00:00")<br>and<br>
Rcpp::Datetime dt("2015-04-15 06:00:00.0")<br>both fail due to a type conversion error.<br><br>Here is the original constructor:<br>Datetime::Datetime(const std::string &s, const std::string &fmt) {<br> Rcpp::Function strptime("strptime"); // we cheat and call strptime() from R<br>
m_dt = Rcpp::as<double>(strptime(s, fmt));<br> update_tm();<br>}<br><br>The problem is that strptime() returns POSIXlt type, not POSIXct type.<br>Adding Rcpp::Function asPOSIXct("as.POSIXct") and using it<br>
to convert seems to fix the problem.<br><br>Dominick<br><br><br>