まつもと ゆきひろです.

In message "[ruby-list:2114] Time + Float"
    on 97/02/12, sinara / blade.nagaokaut.ac.jp <sinara / blade.nagaokaut.ac.jp> writes:

|Time.new + 1.0
|
|で Floating point exception が出ます。

うわっと! 恥ずかしい.

--- time.c~	Mon Feb 10 00:33:01 1997
+++ time.c	Wed Feb 12 16:02:16 1997
@@ -452,8 +452,9 @@
 
     GetTimeval(time1, tobj1);
     if (TYPE(time2) == T_FLOAT) {
-	sec = tobj1->tv.tv_sec + (unsigned int)RFLOAT(time2)->value;
-	usec = tobj1->tv.tv_usec + (RFLOAT(time2)->value - (double)sec)*1e6;
+	unsigned int nsec = (unsigned int)RFLOAT(time2)->value;
+	sec = tobj1->tv.tv_sec + nsec;
+	usec = tobj1->tv.tv_usec + (RFLOAT(time2)->value - (double)nsec)*1e6;
     }
     else if (obj_is_instance_of(time2, cTime)) {
 	GetTimeval(time2, tobj2);