diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-11-13 16:00:53 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-11-13 16:00:53 +0000 |
commit | 5cfe7b5250f3e762be7f36106b1b13e48f7bda1a (patch) | |
tree | b9b571a43d86bda67a18a05d95f0a437b5500b3b /time.c | |
parent | e03d90e475e8642daf5d9aee4543be4de8a5928d (diff) | |
download | ruby-5cfe7b5250f3e762be7f36106b1b13e48f7bda1a.tar.gz ruby-5cfe7b5250f3e762be7f36106b1b13e48f7bda1a.tar.xz ruby-5cfe7b5250f3e762be7f36106b1b13e48f7bda1a.zip |
* include/ruby/ruby.h: introduce 2 macros:
RFLOAT_VALUE(v), DOUBLE2NUM(dbl).
Rename RFloat#value -> RFloat#double_value.
Do not touch RFloat#double_value directly.
* bignum.c, insns.def, marshal.c, math.c, numeric.c, object.c,
pack.c, parse.y, process.c, random.c, sprintf.c, string.c,
time.c: apply above changes.
* ext/dl/mkcallback.rb, ext/json/ext/generator/generator.c:
ditto.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@13913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'time.c')
-rw-r--r-- | time.c | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -173,15 +173,15 @@ time_timeval(VALUE time, int interval) break; case T_FLOAT: - if (interval && RFLOAT(time)->value < 0.0) + if (interval && RFLOAT_VALUE(time) < 0.0) rb_raise(rb_eArgError, "%s must be positive", tstr); else { double f, d; - d = modf(RFLOAT(time)->value, &f); + d = modf(RFLOAT_VALUE(time), &f); t.tv_sec = (time_t)f; if (f != t.tv_sec) { - rb_raise(rb_eRangeError, "%f out of Time range", RFLOAT(time)->value); + rb_raise(rb_eRangeError, "%f out of Time range", RFLOAT_VALUE(time)); } t.tv_usec = (time_t)(d*1e6+0.5); } @@ -868,7 +868,7 @@ time_to_f(VALUE time) struct time_object *tobj; GetTimeval(time, tobj); - return rb_float_new((double)tobj->tv.tv_sec+(double)tobj->tv.tv_usec/1e6); + return DOUBLE2NUM((double)tobj->tv.tv_sec+(double)tobj->tv.tv_usec/1e6); } /* @@ -1324,7 +1324,7 @@ time_minus(VALUE time1, VALUE time2) f += ((double)tobj->tv.tv_usec - (double)tobj2->tv.tv_usec)*1e-6; /* XXX: should check float overflow on 64bit time_t platforms */ - return rb_float_new(f); + return DOUBLE2NUM(f); } return time_add(tobj, time2, -1); } |