[[Rcpp::export]]
| 214 | |
| 215 | // [[Rcpp::export]] |
| 216 | double test_mktime(Date d) { |
| 217 | const int baseYear = 1900; |
| 218 | struct tm tm; |
| 219 | tm.tm_sec = tm.tm_min = tm.tm_hour = tm.tm_isdst = 0; |
| 220 | |
| 221 | tm.tm_mday = d.getDay(); |
| 222 | tm.tm_mon = d.getMonth() - 1; // range 0 to 11 |
| 223 | tm.tm_year = d.getYear() - baseYear; |
| 224 | time_t t = mktime00(tm); // use mktime() replacement borrowed from R |
| 225 | return static_cast<double>(t); |
| 226 | } |
| 227 | |
| 228 | // [[Rcpp::export]] |
| 229 | Date test_gmtime(double d) { |