22 #ifndef Rcpp__newDatetimeVector_h
23 #define Rcpp__newDatetimeVector_h
31 template <
int RTYPE,
bool NA,
typename VEC>
48 size_t n = this->
size();
49 std::vector<Datetime> v(n);
50 for (
size_t i=0; i<n; i++)
58 this->
attr(
"tzone") = rhs.
attr(
"tzone");
70 SET_STRING_ELT(datetimeclass, 0, Rf_mkChar(
"POSIXct"));
71 SET_STRING_ELT(datetimeclass, 1, Rf_mkChar(
"POSIXt"));
72 Rf_setAttrib(*
this, R_ClassSymbol, datetimeclass);
74 if (strcmp(tz,
"") != 0) {
76 Rf_setAttrib(*
this, Rf_install(
"tzone"), tzsexp);
83 for (
size_t i=0; i<n; i++) {
85 if ((i+1) % 4 == 0) os <<
"\n";
AttributeProxy attr(const std::string &name)
std::string format(const char *fmt="%Y-%m-%d %H:%M:%S") const
Vector & operator=(const Vector &rhs)
newDatetimeVector(SEXP vec, const char *tz="")
newDatetimeVector(int n, const char *tz="")
std::vector< Datetime > getDatetimes() const
newDatetimeVector(const VectorBase< RTYPE, NA, VEC > &other, const char *tz="")
void setClass(const char *tz)
newDatetimeVector & operator=(const newDatetimeVector &rhs)
friend std::ostream & operator<<(std::ostream &s, const newDatetimeVector d)
std::ostream & operator<<(std::ostream &os, const Date d)