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