[Rcpp-devel] [Rcpp-commits] r173 - pkg/src
noreply at r-forge.r-project.org
noreply at r-forge.r-project.org
Mon Nov 16 02:08:45 CET 2009
Author: edd
Date: 2009-11-16 02:08:45 +0100 (Mon, 16 Nov 2009)
New Revision: 173
Modified:
pkg/src/RcppDatetime.cpp
Log:
only whitespace changes
Modified: pkg/src/RcppDatetime.cpp
===================================================================
--- pkg/src/RcppDatetime.cpp 2009-11-16 01:06:01 UTC (rev 172)
+++ pkg/src/RcppDatetime.cpp 2009-11-16 01:08:45 UTC (rev 173)
@@ -21,39 +21,39 @@
#include <RcppDatetime.h>
RcppDatetime::RcppDatetime(void) : m_d(0),
- m_parsed(false),
- m_us(0) {
+ m_parsed(false),
+ m_us(0) {
};
RcppDatetime::RcppDatetime(const double d) : m_d(d),
- m_parsed(false),
- m_us(0) {
+ m_parsed(false),
+ m_us(0) {
};
void RcppDatetime::parseTime() {
- // tt is the nb of seconds, ignores fractional microsec
- time_t tt = static_cast<time_t>(floor(m_d));
- m_tm = *localtime(&tt); // parse time type into time structure
+ // tt is the nb of seconds, ignores fractional microsec
+ time_t tt = static_cast<time_t>(floor(m_d));
+ m_tm = *localtime(&tt); // parse time type into time structure
- // m_us is fractional (micro)secs is diff. between (fractional) m_d and m_tm
- m_us = static_cast<int>(round( (m_d - tt) * 1.0e6));
+ // m_us is fractional (micro)secs is diff. between (fractional) m_d and m_tm
+ m_us = static_cast<int>(round( (m_d - tt) * 1.0e6));
- m_parsed = true; // and note that we parsed the time type
+ m_parsed = true; // and note that we parsed the time type
};
std::ostream& operator<<(std::ostream& os, const RcppDatetime &datetime) {
- RcppDatetime dt(datetime);
- dt.parseTime();
- char buf[32], usec[16];
- strftime(buf, 31, "%Y-%m-%d %H:%M:%S", &dt.m_tm);
- snprintf(usec, 15, ".%.06d", dt.m_us);
- os << buf << usec;
- return os;
+ RcppDatetime dt(datetime);
+ dt.parseTime();
+ char buf[32], usec[16];
+ strftime(buf, 31, "%Y-%m-%d %H:%M:%S", &dt.m_tm);
+ snprintf(usec, 15, ".%.06d", dt.m_us);
+ os << buf << usec;
+ return os;
};
RcppDatetime operator+(const RcppDatetime &date, double offset) {
- RcppDatetime tmp(date.m_d);
- tmp.m_d += offset;
- tmp.m_parsed = false;
- return tmp;
+ RcppDatetime tmp(date.m_d);
+ tmp.m_d += offset;
+ tmp.m_parsed = false;
+ return tmp;
};
_______________________________________________
Rcpp-commits mailing list
Rcpp-commits at lists.r-forge.r-project.org
https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/rcpp-commits
More information about the Rcpp-devel
mailing list