summaryrefslogtreecommitdiff
path: root/time.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-08-19 05:56:09 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-08-19 05:56:09 +0000
commitae23000c0e0e4f4af1b4462147d950549b3abdbe (patch)
tree15aff53955adad0d278851c21030857a07bd2f5f /time.c
parent71a202fc01c3284608f486dd8ebb95bc57203221 (diff)
* 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: svn+ssh://ci.ruby-lang.org/ruby/trunk@2720 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'time.c')
-rw-r--r--time.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/time.c b/time.c
index fe22303b83..57027ca928 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)) {