summaryrefslogtreecommitdiffhomepage
path: root/mrbgems/mruby-time
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2017-04-25 17:43:03 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2017-04-25 17:43:03 +0900
commit92dcfbaab38f3d848dcbd13c84be32d9f70f6e4a (patch)
tree3eca3534bb84d0ff990689da6322167264e53c2b /mrbgems/mruby-time
parentb08dced2a63b24c215aba913d3a1a2f4d62f6e8d (diff)
downloadmruby-92dcfbaab38f3d848dcbd13c84be32d9f70f6e4a.tar.gz
mruby-92dcfbaab38f3d848dcbd13c84be32d9f70f6e4a.zip
Add explicit cast from double to long.
Diffstat (limited to 'mrbgems/mruby-time')
-rw-r--r--mrbgems/mruby-time/src/time.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/mrbgems/mruby-time/src/time.c b/mrbgems/mruby-time/src/time.c
index e367ddb64..33755f570 100644
--- a/mrbgems/mruby-time/src/time.c
+++ b/mrbgems/mruby-time/src/time.c
@@ -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;
}