Sometimes the timestamp is provided as a single double, not a vector

This commit is contained in:
2020-11-09 12:38:44 +00:00
parent f6af7b7e3c
commit 0a95f19d31

View File

@@ -89,7 +89,11 @@ SEXP R_TimestampExt(int64_t ts)
int64_t R_TimestampUnix(SEXP r_ts)
{
return (int64_t)(Rf_asReal(VECTOR_ELT(r_ts, 0)) / 1);
if (TYPEOF(r_ts) == REALSXP) {
return (int64_t)(Rf_asReal(r_ts) / 1);
} else {
return (int64_t)(Rf_asReal(VECTOR_ELT(r_ts, 0)) / 1);
}
}
int64_t R_TimestampExtUnix(SEXP r_ts)