From 25c0cb981af8fda9860ec6e365b9ea7a9e3f498f Mon Sep 17 00:00:00 2001 From: ko1 Date: Tue, 13 Nov 2007 16:00:53 +0000 Subject: * 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@13913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- time.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'time.c') diff --git a/time.c b/time.c index e22ac7367d..d2f9a729e8 100644 --- a/time.c +++ b/time.c @@ -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); } -- cgit v1.2.3