diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-11-22 09:14:24 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-11-22 09:14:24 +0000 |
commit | 33a031bcbb66d412691c5dcbb5060841d18f31b3 (patch) | |
tree | cce3e69dea4b7f93481a4cdc5d16c61558cfa546 /time.c | |
parent | c5c1bc0f2d80d5b23cbd2b92e35bd0f35bc97e27 (diff) | |
download | ruby-33a031bcbb66d412691c5dcbb5060841d18f31b3.tar.gz ruby-33a031bcbb66d412691c5dcbb5060841d18f31b3.tar.xz ruby-33a031bcbb66d412691c5dcbb5060841d18f31b3.zip |
* file.c (rb_find_file_ext): should not terminate searching with
empty path, just ignore.
* dir.c: remove <sys/parm.h> inclusion.
* compar.c (cmp_eq,cmp_gt,cmp_ge,cmp_lt,cmp_le): check using
rb_cmpint().
* error.c (init_syserr): remove sys_nerr dependency.
* numeric.c (num_cmp): added to satisfy Comparable assumption.
* eval.c (rb_add_method): "initialize" should be public if it is a
singleton method.
* regex.c (re_match): avoid dereferencing if size == 0.
(ruby-bugs-ja:PR#360)
* time.c (time_cmp): should return nil if an operand is not a
number nor time. (ruby-bugs-ja:PR#359)
* file.c (rb_stat_cmp): should return nil if an operand is not
File::Stat.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@3076 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'time.c')
-rw-r--r-- | time.c | 23 |
1 files changed, 5 insertions, 18 deletions
@@ -713,6 +713,10 @@ time_cmp(time1, time2) case T_FLOAT: return rb_dbl_cmp((double)tobj1->tv.tv_sec + (double)tobj1->tv.tv_usec*1e-6, RFLOAT(time2)->value); + + case T_BIGNUM: + return rb_dbl_cmp((double)tobj1->tv.tv_sec + (double)tobj1->tv.tv_usec*1e-6, + rb_big2dbl(time2)); } if (TYPE(time2) == T_DATA && RDATA(time2)->dfree == time_free) { @@ -725,24 +729,7 @@ 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) - return INT2FIX(0); - if (tobj1->tv.tv_usec > 0) - return INT2FIX(1); - return INT2FIX(-1); - } - if (tobj1->tv.tv_sec > i) return INT2FIX(1); - return INT2FIX(-1); + return Qnil; } static VALUE |