MCPcopy Create free account
hub / github.com/RcppCore/Rcpp / test_mktime

Function test_mktime

inst/tinytest/cpp/dates.cpp:216–226  ·  view source on GitHub ↗

[[Rcpp::export]]

Source from the content-addressed store, hash-verified

214
215// [[Rcpp::export]]
216double 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]]
229Date test_gmtime(double d) {

Callers

nothing calls this directly

Calls 4

mktime00Function · 0.50
getDayMethod · 0.45
getMonthMethod · 0.45
getYearMethod · 0.45

Tested by

no test coverage detected