Permalink
Browse files

Implemented round(double) function within mruby-time gem, for it is m…

…issing on

VisualStudio compilers where _MSC_ver < 1800
  • Loading branch information...
pbosetti committed Nov 27, 2015
1 parent 9a41db6 commit 67e3cdfa76f072e52d76b6535587adccda310f4e
Showing with 10 additions and 0 deletions.
  1. +10 −0 mrbgems/mruby-time/src/time.c
@@ -11,6 +11,16 @@
#include <mruby/class.h>
#include <mruby/data.h>
#if _MSC_VER < 1800
double round(double x) {
if (x >= 0.0) {
return (double)((int)(x + 0.5));
} else {
return (double)((int)(x - 0.5));
}
}
#endif
#if !defined(__MINGW64__) && defined(_WIN32)
# define llround(x) round(x)
#endif

0 comments on commit 67e3cdf

Please sign in to comment.