[Rquantlib-commits] r335 - pkg/RQuantLib/src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Thu Jan 16 02:38:56 CET 2014
Author: edd
Date: 2014-01-16 02:38:56 +0100 (Thu, 16 Jan 2014)
New Revision: 335
Modified:
pkg/RQuantLib/src/utils.cpp
Log:
make the epoch-offset between QL and R an internal const here, rather than accessing it from R's Date class
Modified: pkg/RQuantLib/src/utils.cpp
===================================================================
--- pkg/RQuantLib/src/utils.cpp 2013-06-05 02:51:26 UTC (rev 334)
+++ pkg/RQuantLib/src/utils.cpp 2014-01-16 01:38:56 UTC (rev 335)
@@ -295,9 +295,11 @@
// return(d.getJDN() - RcppDate::Jan1970Offset + RcppDate::QLtoJan1970Offset);
// }
+static const unsigned int QLtoJan1970Offset = 25569; // Offset between R / Unix epoch
+
// R and Rcpp::Date use the same 'days since epoch' representation; QL uses Excel style
int dateFromR(const Rcpp::Date &d) {
- return(d.getDate() + Rcpp::Date::QLtoJan1970Offset);
+ return(d.getDate() + QLtoJan1970Offset);
}
QuantLib::DayCounter getDayCounter(const double n){
More information about the Rquantlib-commits
mailing list