summaryrefslogtreecommitdiff
path: root/time.c
diff options
context:
space:
mode:
Diffstat (limited to 'time.c')
-rw-r--r--time.c23
1 files changed, 5 insertions, 18 deletions
diff --git a/time.c b/time.c
index 30b13fb674..adb92c7eba 100644
--- a/time.c
+++ b/time.c
@@ -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