mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* time.c (time_cmp): should handle Bignums.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@1908 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
03960ec8ff
commit
c9c94c2fee
2 changed files with 12 additions and 0 deletions
|
@ -1,3 +1,7 @@
|
|||
Thu Dec 13 10:03:18 2001 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* time.c (time_cmp): should handle Bignums.
|
||||
|
||||
Mon Dec 10 17:40:02 2001 K.Kosako <kosako@sofnec.co.jp>
|
||||
|
||||
* parse.y (str_extend): make up pushback call.
|
||||
|
|
8
time.c
8
time.c
|
@ -500,6 +500,14 @@ time_cmp(time1, time2)
|
|||
if (tobj1->tv.tv_sec > tobj2->tv.tv_sec) return INT2FIX(1);
|
||||
return INT2FIX(-1);
|
||||
}
|
||||
if (TYPE(time2) == T_BIGNUM) {
|
||||
double a = (double)tobj1->tv.tv_sec+(double)tobj1->tv.tv_usec/1e6;
|
||||
double b = rb_big2dbl(time2);
|
||||
|
||||
if (a == b) return INT2FIX(0);
|
||||
if (a > b) return INT2FIX(1);
|
||||
if (a < b) return INT2FIX(-1);
|
||||
}
|
||||
i = NUM2LONG(time2);
|
||||
if (tobj1->tv.tv_sec == i) {
|
||||
if (tobj1->tv.tv_usec == 0)
|
||||
|
|
Loading…
Add table
Reference in a new issue