[Rcpp-commits] r3761 - in pkg/RcppBDT: . src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Sun Sep 2 03:38:07 CEST 2012
Author: edd
Date: 2012-09-02 03:38:06 +0200 (Sun, 02 Sep 2012)
New Revision: 3761
Modified:
pkg/RcppBDT/ChangeLog
pkg/RcppBDT/src/RcppBDTtz.cpp
Log:
simplified thanks to ptime wrappers
Modified: pkg/RcppBDT/ChangeLog
===================================================================
--- pkg/RcppBDT/ChangeLog 2012-09-02 01:36:52 UTC (rev 3760)
+++ pkg/RcppBDT/ChangeLog 2012-09-02 01:38:06 UTC (rev 3761)
@@ -7,10 +7,12 @@
simplified existing code by using them; and added new setter from the
R Datetime class as well
- * man/bdtDu.Rd: Added
- * man/bdtPt.Rd: Added
- * man/bdtTz.Rd: Added
+ * man/bdtDu.Rd: Added manual page for duration class
+ * man/bdtPt.Rd: Added manual page for ptime class
+ * man/bdtTz.Rd: Added manual page for tzone class
+ * demo/RcppBDTtz.R: Added new demo for tzone class
+
2012-08-27 Dirk Eddelbuettel <edd at debian.org>
* src/RcppBDTpt.cpp: getDatetime() now uses struct tm and mktime
Modified: pkg/RcppBDT/src/RcppBDTtz.cpp
===================================================================
--- pkg/RcppBDT/src/RcppBDTtz.cpp 2012-09-02 01:36:52 UTC (rev 3760)
+++ pkg/RcppBDT/src/RcppBDTtz.cpp 2012-09-02 01:38:06 UTC (rev 3761)
@@ -68,12 +68,8 @@
// dt.attr("tzone") = m_tzone;
// return dt;
// }
- Rcpp::Datetime getDstLocalStart(const int year) {
- boost::posix_time::ptime t = m_tzp->dst_local_start_time(year);
- boost::posix_time::ptime epoch(boost::gregorian::date(1970,1,1));
- boost::posix_time::time_duration::sec_type x = // need to correct difference to epoch by UTC offset
- (t - epoch - m_tzp->base_utc_offset()).total_seconds();
- return Rcpp::Datetime(x);
+ Rcpp::Datetime getDstLocalStart(const int year) {
+ return Rcpp::wrap( m_tzp->dst_local_start_time(year) ); // uses posix_time::ptime wrap()
}
// SEXP getDstEnd(const int year) {
// boost::posix_time::ptime t = m_tzp->dst_local_end_time(year);
@@ -85,11 +81,7 @@
// return dt;
// }
Rcpp::Datetime getDstLocalEnd(const int year) {
- boost::posix_time::ptime t = m_tzp->dst_local_end_time(year);
- boost::posix_time::ptime epoch(boost::gregorian::date(1970,1,1));
- boost::posix_time::time_duration::sec_type x = // need to correct difference to epoch by UTC offset
- (t - epoch - m_tzp->base_utc_offset()).total_seconds();
- return Rcpp::Datetime(x);
+ return Rcpp::wrap(m_tzp->dst_local_end_time(year)); // uses posix_time::ptime wrap()
}
private:
More information about the Rcpp-commits
mailing list