diff --git a/ChangeLog b/ChangeLog index 2506760e9c..161b4f16c9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Thu Dec 13 10:03:18 2001 Yukihiro Matsumoto + + * time.c (time_cmp): should handle Bignums. + Mon Dec 10 17:40:02 2001 K.Kosako * parse.y (str_extend): make up pushback call. diff --git a/time.c b/time.c index e6809e16f0..7cd87a26a4 100644 --- a/time.c +++ b/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)