From 2753f846938e5edfd164de9d1c72d5bce7c593ec Mon Sep 17 00:00:00 2001 From: matz Date: Mon, 19 Aug 2002 05:56:09 +0000 Subject: * array.c (sort_2): *a - *b may overflow. * array.c (ary_new): len*sizeof(VALUE) may be a positive value. * array.c (rb_ary_initialize): ditto. * object.c (rb_class_allocate_instance): move singleton class check from rb_obj_alloc(). * re.c (rb_reg_initialize): should not modify frozen Regexp. * ext/tcltklib/tcltklib.c (ip_init): allocation framework. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@2720 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- time.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'time.c') diff --git a/time.c b/time.c index fe22303b8..57027ca92 100644 --- a/time.c +++ b/time.c @@ -713,16 +713,8 @@ time_cmp(time1, time2) return INT2FIX(-1); case T_FLOAT: - { - double t; - - t = (double)tobj1->tv.tv_sec + (double)tobj1->tv.tv_usec*1e-6; - if (t > RFLOAT(time2)->value) - return INT2FIX(1); - if (t < RFLOAT(time2)->value) - return INT2FIX(-1); - return INT2FIX(0); - } + return rb_dbl_cmp((double)tobj1->tv.tv_sec + (double)tobj1->tv.tv_usec*1e-6, + RFLOAT(time2)->value); } if (rb_obj_is_kind_of(time2, rb_cTime)) { -- cgit