File tree Expand file tree Collapse file tree 2 files changed +19
-3
lines changed
inst/include/Rcpp/date_datetime Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change 1+ 2016-10-17 Dirk Eddelbuettel <edd@debian.org>
2+
3+ * inst/include/Rcpp/date_datetime/newDatetimeVector.h (Rcpp): Allow
4+ setting of timezone attribute; default not-set leads to local as in R
5+
162016-10-16 Dirk Eddelbuettel <edd@debian.org>
27
38 * inst/include/Rcpp.h (RCPP_NEW_DATE_DATETIME_VECTORS): Add a new
Original file line number Diff line number Diff line change @@ -28,8 +28,14 @@ namespace Rcpp {
2828
2929 class newDatetimeVector : public NumericVector {
3030 public:
31- newDatetimeVector (SEXP vec) : NumericVector(vec) { setClass (); }
32- newDatetimeVector (int n) : NumericVector(n) { setClass (); }
31+ newDatetimeVector (SEXP vec, const char * tz = " " ) :
32+ NumericVector (vec) {
33+ setClass (tz);
34+ }
35+ newDatetimeVector (int n, const char * tz = " " ) :
36+ NumericVector (n) {
37+ setClass (tz);
38+ }
3339
3440 inline std::vector<Datetime> getDatetimes () const {
3541 int n = this ->size ();
@@ -41,11 +47,16 @@ namespace Rcpp {
4147
4248 private:
4349
44- void setClass () {
50+ void setClass (const char *tz ) {
4551 Shield<SEXP> datetimeclass (Rf_allocVector (STRSXP,2 ));
4652 SET_STRING_ELT (datetimeclass, 0 , Rf_mkChar (" POSIXct" ));
4753 SET_STRING_ELT (datetimeclass, 1 , Rf_mkChar (" POSIXt" ));
4854 Rf_setAttrib (*this , R_ClassSymbol, datetimeclass);
55+
56+ if (tz != " " ) {
57+ Shield<SEXP> tzsexp (Rf_mkString (tz));
58+ Rf_setAttrib (*this , Rf_install (" tzone" ), tzsexp);
59+ }
4960 }
5061 };
5162}
You can’t perform that action at this time.
0 commit comments