summaryrefslogtreecommitdiff
path: root/time.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-05-16 05:13:17 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-05-16 05:13:17 +0000
commit6cbcafb9b953308f62c9d54ed3283fe4ddf002d5 (patch)
tree5ea92dbea11d370ca1b8ee8ed65a2f47c4f4ca8a /time.c
parentc601cf5318c035460250284057a62b7eddcb79fc (diff)
* eval.c (block_pass): chain previous block to the pushing block.
* time.c (time_cmp): does not compare with numbers for interchangeability. (ruby-bugs-ja PR#458) git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'time.c')
-rw-r--r--time.c27
1 files changed, 11 insertions, 16 deletions
diff --git a/time.c b/time.c
index 149f8ec..4b402d1 100644
--- a/time.c
+++ b/time.c
@@ -716,26 +716,21 @@ time_cmp(time1, time2)
}
if (tobj1->tv.tv_sec > i) return INT2FIX(1);
return INT2FIX(-1);
-
- 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) {
- GetTimeval(time2, tobj2);
- if (tobj1->tv.tv_sec == tobj2->tv.tv_sec) {
- if (tobj1->tv.tv_usec == tobj2->tv.tv_usec) return INT2FIX(0);
- if (tobj1->tv.tv_usec > tobj2->tv.tv_usec) return INT2FIX(1);
+ case T_DATA:
+ if (RDATA(time2)->dfree == time_free) {
+ GetTimeval(time2, tobj2);
+ if (tobj1->tv.tv_sec == tobj2->tv.tv_sec) {
+ if (tobj1->tv.tv_usec == tobj2->tv.tv_usec) return INT2FIX(0);
+ if (tobj1->tv.tv_usec > tobj2->tv.tv_usec) return INT2FIX(1);
+ return INT2FIX(-1);
+ }
+ if (tobj1->tv.tv_sec > tobj2->tv.tv_sec) return INT2FIX(1);
return INT2FIX(-1);
}
- if (tobj1->tv.tv_sec > tobj2->tv.tv_sec) return INT2FIX(1);
- return INT2FIX(-1);
+ break;
}
+
return Qnil;
}