[Rcpp-commits] r3816 - pkg/RcppBDT/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Tue Oct 23 16:00:06 CEST 2012


Author: edd
Date: 2012-10-23 16:00:06 +0200 (Tue, 23 Oct 2012)
New Revision: 3816

Modified:
   pkg/RcppBDT/src/RcppBDTdu.cpp
Log:
add + and - operators for bdtDu and int


Modified: pkg/RcppBDT/src/RcppBDTdu.cpp
===================================================================
--- pkg/RcppBDT/src/RcppBDTdu.cpp	2012-10-23 13:59:09 UTC (rev 3815)
+++ pkg/RcppBDT/src/RcppBDTdu.cpp	2012-10-23 14:00:06 UTC (rev 3816)
@@ -44,6 +44,12 @@
         return new bdtDu( e1->m_td * e2 ) ;   
     } else if( ! op.compare("/") ){
         return new bdtDu( e1->m_td / e2 ) ;
+    } else if( ! op.compare("+") ){
+        //Rf_warning("Interpreting int as seconds");
+        return new bdtDu(e1->m_td + boost::posix_time::time_duration(0,0,e2,0));
+    } else if( ! op.compare("-") ){
+        //Rf_warning("Interpreting int as seconds");
+        return new bdtDu(e1->m_td - boost::posix_time::time_duration(0, 0, e2, 0));
     }
     Rf_error( "operator not implemented" )  ;
     // not reached



More information about the Rcpp-commits mailing list