* time.c (time_cmp): retry with right hand operand if its not a

time object.  [ruby-dev:35011]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18566 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2008-08-13 07:13:27 +00:00
parent 0d242ac61a
commit 090004886d
2 changed files with 16 additions and 1 deletions

View File

@ -1,3 +1,8 @@
Wed Aug 13 16:05:50 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* time.c (time_cmp): retry with right hand operand if its not a
time object. [ruby-dev:35011]
Wed Aug 13 15:51:22 2008 Akinori MUSHA <knu@iDaemons.org>
* string.c: Apply a temporary fix to fix build on OS X. A real

12
time.c
View File

@ -1087,8 +1087,18 @@ time_cmp(VALUE time1, VALUE time2)
if (tobj1->ts.tv_sec > tobj2->ts.tv_sec) return INT2FIX(1);
return INT2FIX(-1);
}
else {
VALUE cmp;
int n;
return Qnil;
cmp = rb_funcall(time2, rb_intern("<=>"), 1, time1);
if (NIL_P(cmp)) return Qnil;
n = rb_cmpint(cmp, time1, time2);
if (n == 0) return INT2FIX(0);
if (n > 0) return INT2FIX(1);
return INT2FIX(-1);
}
}
/*