Skip to content

Commit

Permalink
Add explicit cast from double to long.
Browse files Browse the repository at this point in the history
  • Loading branch information
matz committed Apr 25, 2017
1 parent b08dced commit 92dcfba
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mrbgems/mruby-time/src/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit 92dcfba

Please sign in to comment.