New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce -Wconversion warnings for date-time code #687

Merged
merged 2 commits into from May 5, 2017
Jump to file or symbol
Failed to load files and symbols.
+2 −2
Diff settings

Always

Just for now

Viewing a subset of changes. View all
Prev

use static_cast<>

  • Loading branch information...
krlmlr committed May 5, 2017
commit 9dbbcb5f3d77bf4973093706eb24f1e99b3d5d36
@@ -127,7 +127,7 @@ namespace Rcpp {
// update m_tm based on m_d
void update_tm() {
if (R_FINITE(m_d)) {
time_t t = (time_t)(24*60*60 * m_d); // (fractional) days since epoch to seconds since epoch
time_t t = static_cast<time_t>(24*60*60 * m_d); // (fractional) days since epoch to seconds since epoch
m_tm = *gmtime_(&t);
} else {
m_tm.tm_sec = m_tm.tm_min = m_tm.tm_hour = m_tm.tm_isdst = NA_INTEGER;
@@ -158,7 +158,7 @@ namespace Rcpp {
inline Date operator+(const Date &date, int offset) {
Date newdate(date.m_d);
newdate.m_d += offset;
time_t t = (time_t)(24*60*60 * newdate.m_d); // days since epoch to seconds since epo
time_t t = static_cast<time_t>(24*60*60 * newdate.m_d); // days since epoch to seconds since epo
newdate.m_tm = *gmtime_(&t);
return newdate;
}
ProTip! Use n and p to navigate between commits in a pull request.