Skip to content
Permalink
Browse files
Add explicit cast from double to long.
  • Loading branch information
matz committed Apr 25, 2017
1 parent b08dced commit 92dcfbaab38f3d848dcbd13c84be32d9f70f6e4a
Showing 1 changed file with 2 additions and 2 deletions.
@@ -255,12 +255,12 @@ time_alloc(mrb_state *mrb, double sec, double usec, enum mrb_timezone timezone)
tm->sec = tsec;
tm->usec = (time_t)llround((sec - tm->sec) * 1.0e6 + usec);
if (tm->usec < 0) {
long sec2 = NDIV(usec,1000000); /* negative div */
long sec2 = (long)NDIV(usec,1000000); /* negative div */
tm->usec -= sec2 * 1000000;
tm->sec += sec2;
}
else if (tm->usec >= 1000000) {
long sec2 = usec / 1000000;
long sec2 = (long)(usec / 1000000);
tm->usec -= sec2 * 1000000;
tm->sec += sec2;
}

0 comments on commit 92dcfba

Please sign in to comment.