[Rcpp-commits] r3799 - in pkg/RcppBDT: . inst src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Oct 21 16:06:12 CEST 2012


Author: edd
Date: 2012-10-21 16:06:12 +0200 (Sun, 21 Oct 2012)
New Revision: 3799

Modified:
   pkg/RcppBDT/ChangeLog
   pkg/RcppBDT/DESCRIPTION
   pkg/RcppBDT/inst/NEWS.Rd
   pkg/RcppBDT/src/RcppBDTpt.cpp
Log:
added a few simple duration operators to posix time class


Modified: pkg/RcppBDT/ChangeLog
===================================================================
--- pkg/RcppBDT/ChangeLog	2012-10-14 23:31:18 UTC (rev 3798)
+++ pkg/RcppBDT/ChangeLog	2012-10-21 14:06:12 UTC (rev 3799)
@@ -1,3 +1,8 @@
+2012-10-21  Dirk Eddelbuettel  <edd at debian.org>
+
+	* src/RcppBDTpt.cpp: Added addHours(), addMinutes(), addSeconds() and
+	addFractionalSeconds() to posix time class, shadowing Boost's side
+
 2012-09-22  Dirk Eddelbuettel  <edd at debian.org>
 
 	* src/RcppBDTdt.cpp: Rewrite of the initial Date functionality in the
@@ -2,3 +7,3 @@
 	style of the three recently added classes which simplifies things
-	greatly; new class transparently replaces old class 
+	greatly; new class transparently replaces old class
 

Modified: pkg/RcppBDT/DESCRIPTION
===================================================================
--- pkg/RcppBDT/DESCRIPTION	2012-10-14 23:31:18 UTC (rev 3798)
+++ pkg/RcppBDT/DESCRIPTION	2012-10-21 14:06:12 UTC (rev 3799)
@@ -1,7 +1,7 @@
 Package: RcppBDT
 Type: Package
 Title: Rcpp bindings for the Boost Date_Time library 
-Version: 0.2.1.3
+Version: 0.2.1.4
 Date: $Date$
 Author: Dirk Eddelbuettel and Romain Francois
 Maintainer: Dirk Eddelbuettel <edd at debian.org>

Modified: pkg/RcppBDT/inst/NEWS.Rd
===================================================================
--- pkg/RcppBDT/inst/NEWS.Rd	2012-10-14 23:31:18 UTC (rev 3798)
+++ pkg/RcppBDT/inst/NEWS.Rd	2012-10-21 14:06:12 UTC (rev 3799)
@@ -2,7 +2,7 @@
 \title{News for Package \pkg{RcppBDT}}
 \newcommand{\cpkg}{\href{http://CRAN.R-project.org/package=#1}{\pkg{#1}}}
 
-\section{Changes in version 0.2.2 (2012-10-01)}{
+\section{Changes in [unreleased] version 0.2.2 (2012-11-01)}{
   \itemize{
     \item New module 'bdtDt' replacing the old 'bdtDate' module in a
     more transparent stule using a local class which is wrapped, just like

Modified: pkg/RcppBDT/src/RcppBDTpt.cpp
===================================================================
--- pkg/RcppBDT/src/RcppBDTpt.cpp	2012-10-14 23:31:18 UTC (rev 3798)
+++ pkg/RcppBDT/src/RcppBDTpt.cpp	2012-10-21 14:06:12 UTC (rev 3799)
@@ -64,6 +64,11 @@
         return Rcpp::Date( ymd.year, ymd.month, ymd.day );
     }
 
+    void addHours(int h)        	  { m_pt += boost::posix_time::time_duration(h, 0, 0, 0); }
+    void addMinutes(int m)        	  { m_pt += boost::posix_time::time_duration(0, m, 0, 0); }
+    void addSeconds(int s)        	  { m_pt += boost::posix_time::time_duration(0, 0, s, 0); }
+    void addFractionalSeconds(int fs)     { m_pt += boost::posix_time::time_duration(0, 0, 0, fs); }
+
 private:
     boost::posix_time::ptime m_pt; 		// private ptime instace
 
@@ -87,5 +92,11 @@
 
         .method("getDatetime",                    &bdtPt::getDatetime,                    "get datetime representation")
         .method("getDate",                        &bdtPt::getDate,                        "get date representation")
+
+        .method("addHours",                       &bdtPt::addHours,                       "add given hours to posix time object")
+        .method("addMinutes",                     &bdtPt::addMinutes,                     "add given minutes to posix time object")
+        .method("addSeconds",                     &bdtPt::addSeconds,                     "add given seconds to posix time object")
+        .method("addFractionalSeconds",           &bdtPt::addFractionalSeconds,           "add given fractional seconds to posix time object")
+
     ;
 }



More information about the Rcpp-commits mailing list